Same program runs on Solaris (GHC version 5.04.3, bootstraped from 4.08.2)
very well but not on freeBSD (GHC version 5.04.1 binary installed from
port).
I ran the server like this
$./echo +RTS -C0
And the client
$ yes | socket ServAddr #ServPort > /dev/null
In Solaris the result was good and server still alive
$./echo +RTS -C0
<socket: 4>
"trying to accept"
({loc=<socket: 5>,type=duplex (read-write),binary=True,
buffering=block (1024)},"211.206.120.250",5049)
"trying to accept"
But in freeBSD server crashes like this
$./echo +RTS -C0
<socket: 3>
"trying to accept"
Fail: does not exist
Action: getHostByAddr
Reason: no such host entry
It only succeeds to accept from IPs on DNS or hosts file.
It is a quite a big bug. Cant write server programs with this
Network library in freeBSD.
Following is the server source code.
======================
-- echo.hs
import IO
import Control.Exception hiding (catch)
import Control.Concurrent
import Network
import Posix
acceptConnections sock = do
print "trying to accept" -- for debugging message
conn(h,host,port) <- accept sock
print conn -- for debugging message
forkIO $ catch (talk conn `finally` hClose h) (\e -> print e)
acceptConnections sock
talk conn(h,host,port) = do
str <- hGetLine h
hPutStrLn h str
hFlush h
talk conn
main = withSocketsDo $ do
installHandler sigPIPE Ignore Nothing
sock <- listenOn $ PortNumber 9900
print sock -- for debugging message
acceptConnections sock
======================
P.S. Has anyone done server programming in Windows ?
Concurrent does not seem to work in windows GHC.
It strangely gets blocked.
--
Ahn Ki-yung
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs