gameServer/hedgewars-server.hs
branch0.9.14
changeset 4247 b9fe93f187c4
parent 4242 5e3c5fe2cb14
child 4295 1f5604cd99be
--- a/gameServer/hedgewars-server.hs	Fri Nov 12 09:49:46 2010 +0100
+++ b/gameServer/hedgewars-server.hs	Fri Nov 12 20:42:36 2010 +0300
@@ -4,6 +4,7 @@
 
 import Network.Socket
 import qualified Network
+import Network.BSD
 import Control.Concurrent.STM
 import Control.Concurrent.Chan
 #if defined(NEW_EXCEPTIONS)
@@ -51,7 +52,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
+        )