Hello Adam,<br><br>Maybe you could use the binary package [1] to always encode the portNumber, etc. in network byte order?&nbsp; Such as available put/get functions: putWord16be :: Word16 -&gt; Put<br><br>Hope this helps...<br>
__<br>Donnie<br><br>1. <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.4.1">http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.4.1</a><br>
<br><br><div><span class="gmail_quote">On 3/7/08, <b class="gmail_sendername">Adam Langley</b> &lt;<a href="mailto:agl@imperialviolet.org">agl@imperialviolet.org</a>&gt; 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 &lt;<a href="mailto:sebell@gmail.com">sebell@gmail.com</a>&gt; wrote:<br> &gt;&nbsp;&nbsp;my test program. The Haskell version, however, does not<br> &gt;&nbsp;&nbsp;return from recvFrom. I&#39;ve also tried wrapping this in a<br>
 &gt;&nbsp;&nbsp;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&#39;ll find that the<br> Haskell code gets it.<br>
 <br> hex(45607) = 0xb227<br> 0x27b2 = 10162<br> <br> In short, PortNum doesn&#39;t do the endian conversion for you. And I<br> don&#39;t know a good way to figure out the endianness of the underlying<br> system from Haskell I&#39;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&#39;s some trick that I&#39;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>