x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Network - How to connect to a remote listening server.

Hello guys, I got a small networking prototype (small scene with few replicated moving actors). I've made a development build and send it over to some friends to test multiplayer networking in UE4. I'm running the client and the server (listening mode) and my mates are trying to connect to through console ("open MyIpAdress"). The thing is that it only works locally (LAN), doesn't seem to work remotely (outside our LAN).

Is there anything we need to do to test remote multiplayer networking outside LAN?

Product Version: Not Selected
Tags:
more ▼

asked Jun 06 '14 at 12:21 AM in Packaging & Deployment

avatar image

tatoforever
21 2 3 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

You must forward port 7777 (or port you entered in DefaultEngine.ini) on you router. Not on you PC. It's named "Port Forwarding". You must open input port on router, then client from the Internet can connect to you. There are two technics to do that programmaticaly from you game on your PC in local network: UPnP and NAT-PMP. Better practice - use combination of technics, e.g. when you router denied access to UPnP or doen't have this, you can try use NAT-PMP. And opposite situation. This technics in combination cover about 96% routers. Other 4%... Well... You can display instruction screen (for manual port forwarding) in your game. :)

more ▼

answered Jun 06 '14 at 01:42 AM

avatar image

Signa
173 13 12 23

avatar image Clapfoot Jun 06 '14 at 01:55 PM

What library do you use for UPnP and NAT-PMP ?

avatar image Signa Jun 06 '14 at 02:16 PM

MiniUPnP for UPnP, libnatpmp (from miniupnp.free.fr) for NAT-PMP. Create two additional ThirdParty for Engine.. Their are small and crossplatform. Exactly what we needed.

avatar image PenguinTD Jun 08 '14 at 07:22 AM

any chance that you can write a wiki howto for MiniUPnP?

avatar image Signa Jun 08 '14 at 08:20 AM

No chance. :)

Due:

  • I'm not very familiar with English language.

  • I'm doesn't have much time for article writing.

  • Integration of miniUPnP into UE4 takes less time that writing article about it.

Shortly, just go into ThirdParty folder and see how Epic does this.

  1. Create folder for our new thirdparty module, named "MiniUPnP" for example.

  2. I'm split up headers and libs into separate folders "include" and "lib". In libs im insert static lib of miniupnp. Into include insert only headers.

  3. Create miniUPnP.Build.cs. E.g. module defenition.

    using UnrealBuildTool;

    public class miniUPnP : ModuleRules { public miniUPnP(TargetInfo Target) { Type = ModuleType.External;

          string miniUPnPPath = UEBuildConfiguration.UEThirdPartyDirectory + "miniUPnP/";
     
             PublicSystemIncludePaths.Add( miniUPnPPath + "include" );
             PublicLibraryPaths.Add( miniUPnPPath + "lib");
     
             PublicAdditionalLibraries.Add("miniupnpc.lib");
         }
     }
    

.

Now i'm develope only for Windows. In this module defenition must be platform dependecies also. "For linux-based systems you must use miniupnp daemon instead client" and another things like this.

Next just add module into your game Build.cs. Include headers, for example in game session or in global *.h:

 #include "ThirdParty/miniUPnP/include/miniupnpc.h"
 #include "ThirdParty/miniUPnP/include/upnpcommands.h"
 #include "ThirdParty/miniUPnP/include/upnperrors.h"

For examples of use see offical miniupnp demo sources. In common:

  1. Search for all upnp-able devices in network.

  2. Make sure that it's a router. And it's grant access to UPnP. And port not "alredy in use". Increase port if needed.

  3. Say router "map outside port xxx as inside port yyy for IP zzz in LAN by protocol UDP/TCP to time 0(infinity) seconds and name this hole as GameName". Procedure SetRedirectAndTest.

Similiar actions for libnatpmp.

avatar image tatoforever Jun 08 '14 at 11:37 AM

Thanks sigma for the heads-up! :)

PS: I really wish now this could be supported internally by UE4.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You need to open a hole in your router firewall and forward the appropriate port to your server, I believe the default is UDP 7777.

more ▼

answered Jun 06 '14 at 12:58 AM

avatar image

Clapfoot
401 16 22 31

avatar image tatoforever Jun 06 '14 at 01:10 AM

Hi, Isn't that done automatically the first time we open the game?

avatar image Acren Jun 06 '14 at 03:34 AM

No, it's on your router not your PC.

avatar image rozenbor Jan 26 '15 at 09:21 AM

In fact you can. It's called UPnP and NAT-PMP,but you should change code to make it work. Port is opened until computer disconnects from net or router reboots or that port opened on another computer. It's a good practice,so there is no problem on multiple computers are able to host game at different time(You can use different ports,which is even better practice)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Got it working! For now, I've manually configured the router but will give it a look to miniupnp for integration later in the process! :) Thanks guys!

more ▼

answered Jun 06 '14 at 06:00 PM

avatar image

tatoforever
21 2 3 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question