Hello,

I have a query about the `net' package implementation provided with
hslibs in ghc-4.08.....

I have built some client server code which uses the UDP protocol.

The primitives SocketPrim.sendTo and SocketPrim.recvFrom explicitly
check the state of the socket and raise an exception if not connected
(or listening) before invoking libc sendto and recvfrom.

This would seem to me to be appropriate for stream orientated
communication however for datagram communication the socket states
`connected' and `listening' are not meaningful.

To get my UDP code to work I had to modify SocketPrim.sendTo and
SocketPrim.recvFrom to remove these socket state checks. In the
situation that these primitives are invoked on an un-connected TCP style
socket, the underlying libc functions return error codes which are
handled appropriately by SocketPrim.


Can someone out there clarify:
  1) Did I miss something here, is there a more appropriate way of
getting access to UDP.
  2) Is there a reason why  the socket state checks are made in
SocketPrim instead of relying on the   underlying libc error  codes?

Thanks
/Marcus


Reply via email to