sockets (ghc-5.04.1)

Peter Thiemann thiemann@informatik.uni-freiburg.de
14 Jan 2003 23:21:42 -0800


Hi,

I have a program that uses INET sockets and I wanted to change it to
use Unix domain sockets. Here is the relevant code:

import Network

  withSocketsDo $ do
  sock <- listenOn portID
  (h, hostname, portnumber) <- accept sock

while this code works fine with

portID = PortNumber (toEnum 9099)

I get an error message when running it with

portID = UnixSocket "/home/thiemann/.socket"

Fail: user error
Reason: accept: can't peform accept on socket in status Bound

The file is still created with the right permissions:
srw-------    1 thiemann users           0 Jan 14 22:48 /home/thiemann/.socket=

Since there is not much that I can do in the Network module, it looks
like there is a problem in its implementation?

BTW, I'm running ghc-5.04.1 on this machine:

[kailua] 108 > uname -a
Linux kailua 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown

It would be very convenient if I could use Unix sockets as they save
me from implementing an authentication protocol.

-Peter