How to use createTransport?

I am currently following the Cloud-Haskell tutorial and stuck in createTransport. It seems to me that I can open the transport on 127.0.0.1 for the server and cannot open the transport for the client to connect to the server. I tried to use two machines, using curl ifconfig.meto get my IP address, however createTransportit will not create transport for me. Any ideas?

EDIT: works locally now.

My program is exactly the same as in the textbook, trying to connect between two machines:

curl ifconfig.me returns 101.119.27.24

Command line for the server:

ServerClientServer 101.119.27.24 9000

Error:

bind: unsupported operation (Cannot assign rerquested address)

EDIT: The server code is as follows:

main :: IO ()
main = do
  [host, port]    <- getArgs
  serverDone      <- newEmptyMVar
  Right transport <- createTransport host port 
  Right endpoint  <- newEndPoint transport
  forkIO $ echoServer endpoint serverDone 
  putStrLn $ "Echo server started at " ++ show (address endpoint)
  readMVar serverDone `onCtrlC` closeTransport transport

The functions echoServerand are onCtrlCdefined in another module.

I changed Right transport <- createTransport host portto

t <- createTransport host port defaultTCPParameters
let transport = case t of
  (Right t) -> t
  (Left e)  -> error $ show e

so that I can see what the error message is.

+5
1

-, :

NAT (, ), , . .

ifconfig (ipconfig Windows). (, ). , , , . , "" . , , - "".

0

All Articles