Messages in this thread | | | Date | Thu, 03 Jun 1999 16:38:18 -0700 | From | Xiaodi Lu <> | Subject | recvfrom in linux not retrun; problem description in detail |
| |
Hi, I found I didn't describe my question clear. I give more detail here.
Here is the example code. ----------------------------------- main( ){ ........ signal(SIGALRM, (void) Handler); flag=0; alarm(1); printf("message 1"); recvfrom(..............); printf("message 3"); } Handler(int sig) { flag=1; printf("message 2"); //kill(getpid( ), SIGPIPE); return 0; } ------------------------------------- Most time it works fine. But when error happen(may be one packet loss), I saw the message 1, and message 2. Message 3 not comming. recvfrom doesn't even return an error value such as EINTR. If I send SIGPIPE signal in Handler, the process will stop and show error message "pipe broken". If don't send SIGPIPE, the process will hang there forever.
I also tried to set the socket as non-blocking. It gives recvfrom error very often. Actually my client need to send many packets to server, and the serveris continuously running. Set it as non-block may lost a lot of data.
I used redhat 5.2, kernel 2.0.36
Thanks! Tracy
begin:vcard n:Lu;Xiaodi tel;home:(408)441-7818 tel;work:(408)346-2476 x-mozilla-html:FALSE adr:;;;;;; version:2.1 email;internet:xlu@exodus.net x-mozilla-cpt:;29088 fn:Lu, Xiaodi end:vcard
| |