recvfrom in linux not retrun; problem description in detail

Xiaodi Lu (xlu@exodus.net)
Thu, 03 Jun 1999 16:38:18 -0700


This is a multi-part message in MIME format.
--------------A516243743CA1983BCF5ED78
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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

--------------A516243743CA1983BCF5ED78
Content-Type: text/x-vcard; charset=us-ascii;
name="xlu.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Xiaodi Lu
Content-Disposition: attachment;
filename="xlu.vcf"

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

--------------A516243743CA1983BCF5ED78--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/