-->
Page 1 of 1

How can I use "espconn_sent"

PostPosted: Fri Jan 23, 2015 12:34 pm
by alonewolfx2
How can I use "espconn_sent" function in function directly? (094 or 095 sdk) or can i send data to server directly?
i am using this code in freertos and working good. but freertos sdk dont have ota upgrade. thats why i am asking :)

Code: Select allvoid 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);

}

Re: How can I use "espconn_sent"

PostPosted: Sun Jan 25, 2015 9:12 pm
by Athena
"programming guide" is provided in SDKv0.9.5 http://bbs.espressif.com/viewtopic.php?f=5&t=154&p=557#p557

Maybe that can help..

In sdkv0.9.5 , you can track "user_esp_platform_check_ip" to find out how to use "espconn_sent"

Re: How can I use "espconn_sent"

PostPosted: Sun Feb 08, 2015 9:38 pm
by cyborgmax
Hello,
I'm having a lot of trouble to send simple messages one after the other, since in the new sdk espconn_sent have been changed a lot, complicating the process of simply send some messages one after the other, seems that we have to create buffers and functions to send, making this way harder and tedious than before, the documentation doesn't help actually, only saying that espconn_sent have to be called after it's own callback. Anyways any simple example of the espconn_sent process with it's callback would clarify this for us.
Hope someone have an example of this and don't mind to share it.
Thanks.