
-----Original Message----- From: Glynn Clements [mailto:glynn.clements@virgin.net] Sent: 10 August 2004 19:06 To: Jon Fairbairn Cc: glasgow-haskell-users@haskell.org
* Shouldn't sClose be reexported from Network?
Once you start down that route, you end up at the inevitable conclusion that everything from the raw syscall imports upwards needs to be re-exported.
* is there a general way to get ghci out of a state where it's got stuff open on inaccessible sockets?
The solution to most problems with the Network module is not to use the Network module, but to use Network.Socket instead.
I had a similar (same?) problem while playing with networking, which was that you could open a socket and do stuff to it with just the functions from Network, but to properly close it you had to use Network.Socket.sClose. It also struck me as odd that Network exported all I needed to use sockets *except* sClose. Alistair. ----------------------------------------- ***************************************************************** 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. *****************************************************************

Bayley, Alistair wrote:
* Shouldn't sClose be reexported from Network?
Once you start down that route, you end up at the inevitable conclusion that everything from the raw syscall imports upwards needs to be re-exported.
* is there a general way to get ghci out of a state where it's got stuff open on inaccessible sockets?
The solution to most problems with the Network module is not to use the Network module, but to use Network.Socket instead.
I had a similar (same?) problem while playing with networking, which was that you could open a socket and do stuff to it with just the functions from Network, but to properly close it you had to use Network.Socket.sClose. It also struck me as odd that Network exported all I needed to use sockets *except* sClose.
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.
Essentially, Network.recvFrom is only of use to "simple, stupid
programs"; specifically, programs which only wish to accept a single
connection.
Also, the use of lazy I/O means that the connection may be closed
prematurely (resulting in EPIPE/SIGPIPE at the client end) if the
program fails to "consume" all of the data (e.g. due to lazy
evaluation).
Additionally, it will throw an exception if it can't get the client's
hostname (which is quite possible; many IP blocks don't have PTR
records, particularly the private blocks, e.g. 192.168.*).
--
Glynn Clements

In local.glasgow-haskell-users, you wrote:
Essentially, Network.recvFrom is only of use to "simple, stupid programs"; specifically, programs which only wish to accept a single connection.
This has been noted (various?) times on the mailing-lists. You'd never want to use it in a real application. Since it's once again causing confusion, maybe it's about time to finally axe it? I don't know if you'd find letters large and friendly enough to use in the documentation to point out its deficiencies...They aren't documented at all atm, I'll see if I can whip up something. Volker -- http://www-i2.informatik.rwth-aachen.de/stolz/ *** PGP *** S/MIME L-Attriwutgrammatik
participants (3)
-
Bayley, Alistair
-
Glynn Clements
-
Volker Stolz