1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
int is_connected = 1;
if(send(s, "19NEV", (int)strlen("19NEV"), 0)<(int)strlen("19NEV"))
{
#ifdef DEBUG
printf("__cmd_19NEV__Connection to socket lost, trying to reconnect...\n");
#endif
is_connected = 0;
shutdown(s, SD_SEND); //closes socket
while(!is_connected)
{
#ifdef DEBUG
printf("__cmd_19NEV__Connection to socket failed. Trying again...\n");
printf("connect au serv = %i",connect(s, (SOCKADDR *)&server, sizeof(server)));
#endif
if (1/*connect(s, (SOCKADDR *)&server, sizeof(server)) != SOCKET_ERROR*/)
{
printf("nb car env = %i",send(s, "19NEV", (int)strlen("19NEV"), 0));
if(send(s, "19NEV", (int)strlen("19NEV"), 0)==(int)strlen("19NEV"))
{
is_connected = 1;
}
}
Sleep(10000);
}
#ifdef DEBUG
printf("__Connection successful\n");
#endif
} |
Partager