Re: ECONNREFUSED in recvfrom ?

Chris Wedgwood (chris@cybernet.co.nz)
Tue, 13 Oct 1998 10:31:37 +1300


On Mon, Oct 12, 1998 at 03:25:34PM +0200, Davide Rossetti wrote:

> hi all,
> i'm stuck with a strange (for me) behaviour of recvfrom with UDP sockets.
> 1) in the man page, this error code is not documented (ok, they are rather
> old)
> 2) the sequence I try is that of a simple echo server (only for test):
>
> create AD_DGRAM socket
> while(select for fd with timeout==-1) {
> recvfrom(addr, buf, ...);
> sendto(addr, buf, ...)
> }
>
> the first time ok. I send a packet from another host, recv and send are
> done. but instead of going back to sleep, it wakes up again and gets an
> ECONNREFUSED error in recvfrom.

A previous packet you sent on that socket was sent to a host that
wasn't listening, it sent back and ICMP packet to this effect and it
gets reported later on...

Have a look at what's going on with tcpdump to see what I mean if my
explanation isn't clear (alan has a clearly explanation that mine).

-cw

-
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/