Ticket #28 (new defect)

Opened 5 years ago

server: getAddrInfo: does not exist (Name or service not known)

Reported by: igloo Owned by:
Priority: major Milestone:
Component: network Version:
Keywords: Cc:

Description

With the server program from http://hackage.haskell.org/packages/archive/network-bytestring/0.1.2.1/doc/html/Network-Socket-ByteString.html#3

module Main where

import Control.Monad
import qualified Data.ByteString as S
import Network.Socket hiding (recv)
import Network.Socket.ByteString

main :: IO ()
main = withSocketsDo $
    do addrinfos <- getAddrInfo Nothing (Just "") (Just "3000")
       let serveraddr = head addrinfos
       sock <- socket (addrFamily serveraddr) Stream defaultProtocol
       bindSocket sock (addrAddress serveraddr)
       listen sock 1
       (conn, _) <- accept sock
       talk conn
       sClose conn
       sClose sock

    where
      talk :: Socket -> IO ()
      talk conn =
          do msg <- recv conn 1024
             unless (S.null msg) $ sendAll conn msg >> talk conn

and network-2.2.1.7 and network-bytestring-0.1.2.1, on Debian/Linux amd64 I get:

$ ./server
server: getAddrInfo: does not exist (Name or service not known)
Note: See TracTickets for help on using tickets.