BufferedTcpObject Connect Timeout issue
Posted: Fri May 13, 2011 7:59 am
I'm trying to use the BufferedTcpObject with an SBL2e, but it appears that the timeout parameter on the Connect call does not work, instead the Connect call blocks forever - and even if the server shows up later, the connect never completes.
Any ideas?
Any ideas?
Code: Select all
static BYTE buffer[256];
BufferedTcpObject tcp(buffer, 256, NULL);
// enter processing loop
while (1) {
if (!tcp.Connected()) {
iprintf("TCP attempting connection to %I : %d\r\n ", DestIP, DestPort);
OSTimeDly(5);
if (tcp.Connect(DestIP, DestPort, 40)) {
iprintf("Connected to server...\r\n");
} else {
iprintf("Connection failed... waiting 5 seconds before retrying...\r\n");
// wait before trying to reconnect to remote server
while ( (rcount < 5 * TICKS_PER_SECOND)) {
rcount++;
OSTimeDly(1);
}
rcount = 0;
}
}
else {
// do something after connected
}
}