[network] #3: Cannot call connect with a socket that is already bound.

network libraries at haskell.org
Tue Jan 20 15:53:45 EST 2009


#3: Cannot call connect with a socket that is already bound.
---------------------+------------------------------------------------------
 Reporter:  igloo    |       Owner:     
     Type:  defect   |      Status:  new
 Priority:  major    |   Milestone:     
Component:  network  |     Version:     
 Keywords:           |  
---------------------+------------------------------------------------------
 Originally reported here: http://hackage.haskell.org/trac/ghc/ticket/2784

 ----

 {{{
 > import Network.Socket
 > sock <- socket AF_INET Datagram 0
 Loading package parsec-2.1.0.1 ... linking ... done.
 Loading package network-2.2.0.1 ... linking ... done.
 > bindSocket sock (SockAddrInet aNY_PORT iNADDR_ANY)
 > connect sock undefined
 *** Exception: user error (connect: can't peform connect on socket in
 status Bound)
 }}}
 Network.Socket.connect checks the !SocketStatus of the socket:
 {{{
 if currentStatus /= NotConnected
 }}}

 From [http://www.opengroup.org/onlinepubs/000095399/functions/connect.html
 The Open Group Base Specifications Issue 6]:
 "If the socket has not already been bound to a local address, connect()
 shall bind it to an address which, unless the socket's address family is
 AF_UNIX, is an unused local address."

-- 
Ticket URL: <http://trac.haskell.org/network/ticket/3>
network <http://projects.haskell.org/network/>
Networking-related facilities


More information about the Libraries mailing list