On Tue, 18 May 1999 00:36:05 -0700 (PDT),
klein fabien <[EMAIL PROTECTED]> wrote:
>I configured my interface to send UDP frames (AF_INET,SOCK_DGRAM,0)
>but how is it possible for sendto to return errno 111 connection
>refused...
>Don t understand this concept of connection using a connectionless
>proto.
A previous UDP packet to the same machine and port got an ICMP message,
probably port not available. Linux treats some ICMP messages as
ECONNREFUSED for UDP. Not all *nix do this, Alan Cox says that Linux
is conforming to the RFC (search linux-net and linux-kernel archives for
ECONNREFUSED).
Simple workaround. Treat ECONNREFUSED as "try again", up to an
arbitrary number of attempts.
for (i = 0; i < 5; ++i) {
if (sendto(...) >= 0 || errno != ECONNREFUSED)
break;
}
Works on all systems.
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]