AnsweredAssumed Answered

TCP connection

Question asked by Camilo A Camacho D on Feb 27, 2013
Latest reply on Feb 28, 2013 by David E Seymour

Hi guys, how are you? I`m having a problem regarding my TCP connection. If my device is connected to an IP of my LAN it works perfectly but when I want to go out to the cloud through my default gateway it connects randomly, almost never, but sometimes it fulfills the connection. I don´t know what`s happening because it seems to be fine and it connects sometimes. It`s not a cable or physical connection problem I thoroughly oversaw it, and like i saud it works fine in a LAN. I`m setting my connection like this:


typedef struct sockaddr_in {

   uint_16  sin_family;

   uint_16  sin_port;

   in_addr  sin_addr;

} sockaddr_in;



       sockaddr_in addr;

       addr.sin_family = AF_INET;

       addr.sin_port = puerto; // Destination port where the server is listening

       addr.sin_addr.s_addr = IPADDR(d_ip0,d_ip1,d_ip2,d_ip3); // Server IP address where the clients connects

       ip_data.gateway = IPADDR(g_puerta0,g_puerta1,g_puerta2,g_puerta3);

       ip_data.mask = IPADDR(g_mascara0,g_mascara1,g_mascara2,g_mascara3);

       sock = socket(AF_INET, SOCK_STREAM, 0);

       //error = bind(sock, &addr, sizeof(addr)); // I`ve tried with or without this line but it doesn´t change at all.


Thank you very much and have a nice week.