Open jwaldmann opened 4 years ago
It should be possible if the machine that runs the server has a public ip address.
But unfortunately it does not work for me:
First I set up my router to forward a specific port. Then I started a server that should use this port.
When a client then tries to connect to the public ip, it does not work.
It is strange that I can actually connect to the server via netcat by running nc PUBLIC_IP PORT
on the client machine.
I ran into the same error some while ago with Cloud Haskell and created an issue [1]. It happened when I tried to connect clients and servers via LAN. I solved the error by not using the version of distributed-process on Hackage and switching to the current revision in github instead. I will reopen the issue and update it accordingly.
[1] https://github.com/haskell-distributed/distributed-process/issues/346
switching to the current revision in github
is this in your cabal.project
?
Yes, but unfortunately it does not work in the case of corona, just for LAN.
I can't even get it to work inside one LAN (behind a home router) (server hangs at "waiting for clients to join", client dies with ".. timeout. No process name at address ..")
wireshark shows packets flowing (between designated server port, 3000, and ad-hoc client port, like 46514) (but not to designated client port, 3001).
I've seen it work in a different LAN (at work). Perhaps something about broadcasting? firewall?
public server with private (NAT) clients probably does not work because the server wants to send pings to the clients so they must be reachable.
server and client must in any case run identical binaries? because messages represent functions in closures by actual machine code addresses - these must be identical on both sides. But as long as we don't send closures?
I've seen it work in a different LAN (at work). Perhaps something about broadcasting? firewall?
This could be a problem related to some firewall. We use network-transport-tcp, so when setting up connections via TCP works with other programs, I think it "should" work with nt-tcp, too.
You can try running netcat (nc
) on your server to test this in your terminal:
nc -l 3000
<- this will open a socket and listen for incoming connections at port 3000
Then run this on the client to connect to the server:
nc IP 3000
where IP is the address of the computer that runs the above command.
When a connection via TCP is set up, the machines then can send text to each other. If there is a problem with your firewall or something else, this would not work.
But as long as we don't send closures?
This is right, we don't send closures, so the binaries do not need to be identical, I tested this some time ago.
If two clients are behind NAT (of their respective home router), can they still play? E.g., by running a server that has a public IP address?