Re: [bug?] udp send to loopback and accept() dropping non-blocking status

Richard B. Johnson (root@chaos.analogic.com)
Wed, 6 Oct 1999 15:29:04 -0400 (EDT)


On Wed, 6 Oct 1999, Lucian B Landry wrote:

> Howdy, first time poster so please don't flame me too hard....
>
> While porting to linux I've run across .. err .. 'anomalies' in some of the
> socket behavior.
>
> 1) When I try to send udp packets to the loopback address, every third(!?)
> port returns an "connection refused" error.
>
> 2) The latest man page I could find for accept() (23 oct 98) states
>
> "The accept function extracts the first connection request on the queue
> of pending connections, creates a new socket *with the same properties of s*,
> and allocates a new file descriptor for the socket"

You use accept() with a connection. UDP is connectionless. There is
no connection. The server just sends UDP datagrams (hoping they get
there), using sendto(), and the proposed listener uses recvfrom(),
collecting as many messages as don't get lost.

If you want a connection, you use a stream socket, not UDP. With this,
the server posts an accept() waiting for a connection which occurs
when the client issues a connect(). After that, either party uses
send() or write(), to send data; and recv() or read(); to receive data.

Data sent/received on a connection is guaranteed to be perfect, but
the time it takes to get there is not guaranteed.

Data sent/received on UDP is not guaranteed to get out of your computer,
although it usually does and, in fact may in some instances, be more
efficient (satellite communication). The 'user' of UDP has to replace
missing data in the user program.

Cheers,
Dick Johnson
**** FILE SYSTEM WAS MODIFIED ****
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

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