[Haskell-cafe] Sockets get bound to wrong port on Windows
ivan.miljenovic at gmail.com
Wed Jun 2 23:20:49 EDT 2010
Sorry for the double-reply Matthias, but I forgot to CC -cafe (GMail
labs isn't working, so reply-to-all is no longer the default for me :(
On 3 June 2010 13:10, Matthias Reisner <matthias.reisner at googlemail.com> wrote:
> there's something wrong with port numbers in the Network.Socket module of
> package network. Printing values gives:
> *Main> PortNum 8888
> *Main> PortNum 47138
This happens to me as well (self-built GHC 6.12.2 with network 184.108.40.206
on some random Ubuntu version I use at uni).
> So I thought it's just an error in the show instance of PortNumber, which
> shows the bytes flipped. But if I use the following code snippet
> sock <- socket AF_INET Datagram 0
> bindSocket sock $ SockAddrInet (PortNum 8888) iNADDR_ANY
> to bind a socket to port 8888, netstat and TCPView reveal that the socket is
> actually bound to the wrong port 47138. I'm using network-220.127.116.11 on Windows
> XP. Is that a bug or am I doing something wrong here?
Tried testing this as well; not sure how to test if the binding worked
but "netstat --numeric-ports" didn't contain 8888 or 47138.
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
More information about the Haskell-Cafe