|
From: | Muhamad Ikhwan Ismail |
Subject: | [lwip-users] Detection remote closed TCP connection |
Date: | Wed, 28 May 2008 08:09:17 +0000 |
Hi guys, I have checked the threads and the last one dated in 2003 and hence rather outdated. I have a telnet server which accepts connection(in an infinite loop) and in case the connection is accepted, it process the I/O using the socket in a nested loop. while(1){ int s = accept(); //blocks untill the connection is accepted for(;;){ //runs IO } } I have a slight problem when the remote host closes the connection. I would want to include a connection status check and jump back to accept() if the connection is closed from the remote host. Is there anyway to do this ? It also has to be non-blocking and can be lwip specific. So far I have heard few suggestions from the old thread : 1. read/write 0 bytes. //blocks ? 2. Use of MSG_PEEK read (in 2003 was not yet implemented ). I hope to hear your suggestions on the matter and thanks a lot in advance. M Ikhwan Ismail STO/CPK ABB STOTZ KONTAKT GmbH Heidelberg Platform : PowerPC MPC852T OS : SMX RTOS with runtime system. Make every e-mail and IM count. Join the i’m Initiative from Microsoft. |
[Prev in Thread] | Current Thread | [Next in Thread] |