--- a/gameServer/hedgewars-server.hs Wed Jan 26 22:04:18 2011 +0300
+++ b/gameServer/hedgewars-server.hs Wed Jan 26 22:06:27 2011 +0300
@@ -2,7 +2,8 @@
module Main where
-import Network
+import Network.Socket
+import Network.BSD
import Control.Concurrent.STM
import Control.Concurrent.Chan
import qualified Control.Exception as Exception
@@ -46,7 +47,14 @@
let serverInfo = serverInfo'
#endif
+
+ proto <- getProtocolNumber "tcp"
Exception.bracket
- (Network.listenOn $ Network.PortNumber $ listenPort serverInfo)
+ (socket AF_INET Stream proto)
sClose
- (startServer serverInfo)
+ (\sock -> do
+ setSocketOption sock ReuseAddr 1
+ bindSocket sock (SockAddrInet (listenPort serverInfo) iNADDR_ANY)
+ listen sock maxListenQueue
+ startServer serverInfo sock
+ )