[asterisk-users] Why is this happening?

Brian Candler B.Candler at pobox.com
Tue Oct 17 13:12:37 MST 2006


On Tue, Oct 17, 2006 at 11:20:02AM -0500, Mitch Miller wrote:
> The "moving to another port" discussion is actually what happens with 
> sockets.  A socket listens on a designated port (ex: port 80) and when a 
> connection is made to that socket, another socket begins to listen to 
> port 80 for NEW connections.

Actually, the original socket continues to listen on port 80 for new
connections, whilst the accept() call creates a new socket for the accepted
connection.

>From the accept(2) manpage:

DESCRIPTION
       The  accept()  system  call  is used with connection-based socket types
       (SOCK_STREAM, SOCK_SEQPACKET and SOCK_RDM).  It extracts the first con‐
       nection request on the queue of pending connections, creates a new con‐
       nected socket, and returns a new  file  descriptor  referring  to  that
       socket.   The  newly created socket is not in the listening state.  The
       original socket sockfd is unaffected by this call.

Regards,

Brian.


More information about the asterisk-users mailing list