Download

Networking noob question

Can I create a client-server connection between two player PCs via internet (not LAN) without Steam? I mean directly by IP?

I did that by blueprints simply calling console functions.

Basically what you want to do is execute those two commands:


open {YourMapName}?listen

  • that will host a new listen server

open {ip address}

  • that will connect your connect to specified IP

So simply execute those commands via C++/BP and you are done. Note that you need to forward your 7777 port on the host machine to let others connect to you :slight_smile:

I tried it. It works for 127.0.0.1, works for LAN internal IP, but not for the external IP. Firewall rule for 7777 is on. That’s why I ask about two player’s PCs. Can normal player’s PC be a game server?

it works - but you have to port forward on your router to the host machine. The other machine should use external router ip.

Start your game with -log parameter (for eg: YourGameName.exe YourMapName?listen -log) and find what port is your GameNetDriver listening to (should be 7777):

Then go to http://api.ipify.org/ to get your ip and tell your friend to use command <youripaddress:yourport> to join your game.

I did it too. From the port 7777 of the router to port 7777 of my PC. My external IP is static. Is it possible that my internet provider blocks this port?

I know my IP and know my listening port. The probem is nobody can connect to me and even I can’t connect using my external IP.

As far as I know you should connect locally with your internal IP. While others should connect with your external ip. For example.

You opened port for internal ip address: 192.168.0.100 => port 7777
You host a server, and connect to it via 192.168.0.100, BUT all others who are NOT in your network, should connect with your external ip.

Btw are you sure your internal ip is the same as the port forwarded?

Yes, my internal IP is fixed in network connection -> TCP/IP settings to 192.168.1.10. In my router admin settings i’ve created a virtual server rule (port forwarding) to redirect 7777 port to 192.168.1.10. But my friend can’t connect to me using my external IP. I can launch a copy of my project and connect when I use 127.0.0.1 or 192.168.1.10, but not exernal IP.

And port check services like this say port 7777 is closed at my IP.

It’s very possible that firewall or antivirus is blocking the port or the connection. I know you said you added an exception, but try disabling both temporarily and see if it has any effect.

I tried it too. Ok, now i understand at least the problem is not about UE.

I have had issues with IP networking since the day I got UE4 over a year ago, and here is what I have to do to be able to host:

Have the other player try to join me using IP with console commands above. <- Does not work.
Have them host, and myself try to join them with IP. <- Does not work.
Have the other player try to join me again via IP. <- DOES work.

I have tested and tried this pattern of joining for many months, with probably 15 people on several projects, and it is how I host games, though still very odd… This must only occur with games that I myself package, because I have always joined game jam multiplayer sessions just fine.

Has this always been tested from your PC? That (or your network) could be the common factor.

Interesting. It makes sence. Looks like port 7777 opens for incoming connections when you try to open an outgoing connection.

I’m SO sorry to necro this thread so hard, but I just came across this and am struggling to get past this exact blocker. Were you ever able to figure out a solution? My situation is exactly as you describe in this post.

Please forgive me reviving this, I am dying for a solution

My ISP blocks these ports for clients with dynamic IPs, so I paid for static IP and it worked. Also, set up port forwarding in your router.