[MLton] INetSock problems, hton/ntoh usage

Vesa Karvonen vesa.a.j.k at gmail.com
Mon Mar 26 12:28:46 PST 2007


On 3/26/07, Matthew Fluet <fluet at tti-c.org> wrote:
> Matthew Fluet wrote:
> > Vesa Karvonen wrote:
> >> The port number of a socket is a 16-bit integer (the sin_port field of
> >> struct sockaddr_in).  OTOH, the current net code in MLton represents port
> >> numbers as C_Int.t values which usually aren't 16-bit integers.
> >
> > I think the better solution would be to use Word16.word for ports in the
> > INetSock structure (and C-side functions in INetSock.c). [...]

I agree.

> Vesa, does this work with your smlbot?

Yes, seems to work.

BTW, smlbot can now be found from mltonlib:

  http://mlton.org/cgi-bin/viewsvn.cgi/mltonlib/trunk/com/ssh/async/unstable/example/smlbot/

One will, of course, need an IRC server to really play with it.  Smlbot
also requires SML/NJ (recent working version).  Smlbot is a very
simple (simplistic is probably more accurate) bot.  It implements a
minimal subset of the IRC protocol and just evaluates the SML
one-liners given to it.

-Vesa Karvonen



More information about the MLton mailing list