Network, sClose
Bayley, Alistair
Alistair_Bayley at ldn.invesco.com
Wed Aug 11 06:51:48 EDT 2004
> -----Original Message-----
> From: Glynn Clements [mailto:glynn.clements at virgin.net]
>
> However, even if sClose was exported, that wouldn't be of any
> help in Jon's case, as neither of the sockets which recvFrom
> creates are visible outside of recvFrom.
Ahh, OK. I haven't used recvFrom/sendTo yet... (trying it now) ... When I
try Jon's example with 6.2.1 (Win XP) I don't get the same error; it works
twice and then hangs (my networking code would hang if I tried to re-use a
socket that hadn't been properly closed).
Is recvFrom meant to be a one-shot function i.e. the socket is only closed
when the process exits?
Jon's second example uses listenOn/accept and handles, which is also what I
used:
> do sock <- listenOn$PortNumber 7607; (hdl,host,port)<- accept sock;
> s<-IO.hGetContents hdl; putStr$s; IO.hClose hdl; Network.Socket.sClose
> sock
Network.Socket.sClose is obviously useful here, so don't you think it would
be a good idea to put it in Network? I don't see why including sClose would
imply that you should start exposing other low-level stuff. AFAICT, it is
the one little thing that's missing from Network that makes writing simple
networking code possible.
There's a lack of symmetry (closure?): you can create a socket with
Network.listenOn, but there is no corresponding close function in Network.
-----------------------------------------
*****************************************************************
Confidentiality Note: The information contained in this
message, and any attachments, may contain confidential
and/or privileged material. It is intended solely for the
person(s) or entity to which it is addressed. Any review,
retransmission, dissemination, or taking of any action in
reliance upon this information by persons or entities other
than the intended recipient(s) is prohibited. If you received
this in error, please contact the sender and delete the
material from any computer.
*****************************************************************
More information about the Glasgow-haskell-users
mailing list