Hello Adam,<br><br>After taking a closer look, the network module does do the ntohs() FFI call:<br><div style="margin-left: 40px;"><a href="http://haskell.org/ghc/docs/latest/html/libraries/network/src/Network-Socket.html#PortNumber">http://haskell.org/ghc/docs/latest/html/libraries/network/src/Network-Socket.html#PortNumber</a><br>
</div><br>Thus, I think the issue is probably that Scott's UDP Client does not do the htons() for the port number, or if the UDP Client is in Haskell, then it is not using the Portnumber constructor.<br>__<br>Donnie<br>
<br><br><div><span class="gmail_quote">On 3/7/08, <b class="gmail_sendername">Adam Langley</b> <<a href="mailto:agl@imperialviolet.org">agl@imperialviolet.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Fri, Mar 7, 2008 at 8:10 AM, Scott Bell <<a href="mailto:sebell@gmail.com">sebell@gmail.com</a>> wrote:<br> > my test program. The Haskell version, however, does not<br> > return from recvFrom. I've also tried wrapping this in a<br>
> withSocketsDo, with no effect.<br> <br> <br>So this is a long standing, ah, issue with the Network modules.<br> <br> Try sending a UDP packet to port 45607 and you'll find that the<br> Haskell code gets it.<br>
<br> hex(45607) = 0xb227<br> 0x27b2 = 10162<br> <br> In short, PortNum doesn't do the endian conversion for you. And I<br> don't know a good way to figure out the endianness of the underlying<br> system from Haskell I'm afraid. I usually end up FFIing out to htons<br>
or just assuming that the system is little-endian.<br> <br> We should really fix this unless there's some trick that I've been<br> missing all this time.<br> <br> <br> AGL<br> <br><br> --<br> Adam Langley <a href="mailto:agl@imperialviolet.org">agl@imperialviolet.org</a> <a href="http://www.imperialviolet.org">http://www.imperialviolet.org</a><br>
<br>_______________________________________________<br> Haskell-Cafe mailing list<br> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br>