i am using this code in freertos and working good. but freertos sdk dont have ota upgrade. thats why i am asking
void sendData(void *pvParameters)
{
printf("starting");
int recbytes;
int sin_size;
int str_len;
int sta_socket;
struct sockaddr_in local_ip;
struct sockaddr_in remote_ip;
sta_socket = socket(PF_INET, SOCK_STREAM, 0);
if (-1 == sta_socket) {
close(sta_socket);
printf("C > socket fail!\n");
}
printf("C > socket ok!\n");
bzero(&remote_ip, sizeof(struct sockaddr_in));
remote_ip.sin_family = AF_INET;
remote_ip.sin_addr.s_addr = inet_addr(server_ip);
remote_ip.sin_port = htons(server_port);
if (0 != connect(sta_socket, (struct sockaddr *)(&remote_ip), sizeof(struct sockaddr))) {
close(sta_socket);
printf("C > connect fail!\n");
}
printf("C > connect ok!\n");
char *pbuf = (char *)zalloc(1024);
sprintf(pbuf, "%s\n", "client_send info");
if (write(sta_socket, pbuf, strlen(pbuf) + 1) < 0) {
printf("C > send fail\n");
}
printf("C > send success\n");
close(sta_socket);
free(pbuf);
vTaskDelete(NULL);
}
Lets get the party started and +1
[url=https://www.banggood.com/custlink/KvGGhGF4wG[/url]
I like ESP8266 and ESP8285 and ESP32