1
Network / I created a server/client TCP connection, but it only works locally. Any ideas?
« on: January 18, 2020, 02:03:44 pm »
So, here's the whole code: https://github.com/Neroooooooo/sfmlNetworking
I posted the github repo link because it's probably more organized. And there are just about 200 lines among 5 files, some of them being comments and cout's, so it shouldn't be hard to understand what's there.
The thing I want to achieve is a server that can receive packets from clients through a TCP connection. Currently, it only works if both the client and the server are on the same machine and I use the local IP to connect. It doesn't even work on 2 different machines connected to the same router.
I tried to forward the port 20000 (used in the code), and connect to the server using the public IP address, but it doesn't work.
https://imgur.com/a/QDhlwAy
I disabled my windows 10 firewalls, it still didn't work.
Can you guys help me here? I'm stuck and I searched everywhere for a solution, but I can't find one. I really want to learn about multiplayer games and networking, but I can't see what I'm doing wrong.
EDIT: I played some more with firewalls, and now it works locally, on 2 different machines connected to the same router. But it does not work with someone that's not connected to the same router. Ideas?
I posted the github repo link because it's probably more organized. And there are just about 200 lines among 5 files, some of them being comments and cout's, so it shouldn't be hard to understand what's there.
The thing I want to achieve is a server that can receive packets from clients through a TCP connection. Currently, it only works if both the client and the server are on the same machine and I use the local IP to connect. It doesn't even work on 2 different machines connected to the same router.
I tried to forward the port 20000 (used in the code), and connect to the server using the public IP address, but it doesn't work.
https://imgur.com/a/QDhlwAy
I disabled my windows 10 firewalls, it still didn't work.
Can you guys help me here? I'm stuck and I searched everywhere for a solution, but I can't find one. I really want to learn about multiplayer games and networking, but I can't see what I'm doing wrong.
EDIT: I played some more with firewalls, and now it works locally, on 2 different machines connected to the same router. But it does not work with someone that's not connected to the same router. Ideas?