Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NAT Traversal - Automatic port forwarding, punch-through, and more!

Discussion in 'Assets and Asset Store' started by thegreatzebadiah, Apr 5, 2016.

  1. lThanatosl

    lThanatosl

    Joined:
    Jan 25, 2013
    Posts:
    40
    Ughhh Man I need some help here...

    So I made the account to get the EC2 server thing.
    I transfer the Facilitator file to it using FileZilla.
    I use Putty to run the Facilitator file.
    I enter the facilitator IP to what my instance on the amazon site tells me (IPv4 Public IP)
    I leave facilitator Port as is (61111)

    and it just keeps saying that it Fails to connect, I just bought the asset and I'm new at this, any ideas?
     
  2. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    714
    Are you able to ping your server's IP from the machine running the game? What OS is your server using? And do you know if a firewall has been enabled on the server?
     
    Last edited: Jun 19, 2017
  3. lThanatosl

    lThanatosl

    Joined:
    Jan 25, 2013
    Posts:
    40
    I don't know how to ping a server's IP, I am using Windows 10, When I set up the server instance I just left everything at default, let me try checking if it has a firewall but I don't know about that either.

    EDIT: Okay tried pinging using the cmd command 'ping' and i placed my server's IPv4 public IP but the request timed out.

    EDIT 2: Okay I added an inbound rule saying I accept all traffic, I can now ping my server, but I still get the cant connect to facilitator message when running my game.

    EDIT 3: Okay now the game connects! : D Now come the in-game bugs.

    I saw the tutorial video explaining that all you need to use is StartHostAll instead of CreateMatch, and StartClientAll instead of JoinMatch, but I get these errors:
    http://i.imgur.com/EqLRPlu.png And a few more down below but they're probably related to these.

    The network manager came with 'network port' set to 7777 by default, do i need to change it?
     
    Last edited: Jun 19, 2017
    CloudyVR likes this.
  4. lThanatosl

    lThanatosl

    Joined:
    Jan 25, 2013
    Posts:
    40
    Yeah so i get 'Something went wrong mapping port 7777->7777' (Udp) and (Tcp) (http://i.imgur.com/UzchTlW.png)

    after calling StartHostAll, has anyone encountered this at all? The game connects to the facilitator no problem as well.

    EDIT: I changed the port to 50000 and it worked, i can make a room and join it, weird.
     
    Last edited: Jun 21, 2017
  5. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    714
    I am nearly finished with my new LobbyManager scripts and all is working great!
    However there is one part that I don't quite understand. When I start the game I notice that after about 10 seconds the value in manager.matchName is updated by something in the background, the value looks similar to:

    |192.168.1.100|87.240.125.220|fa85::2d2b:f321:4158:a5b7||1077877777135777248

    What I am doing currently is to wait for this value (when: matchName.Length > 0) and then store it so it can be used to create new matches in the future. I found an issue where if I join a game prior to receiving that address then the value in manager.matchName will reflect the address of the server that I just joined and I will have never gotten the address to create new matches locally.

    What exactly is that string and what should I call to get it (if it exists) when I need it during runtime?
    I think I understand what some of the values between the delimiters are: |Local IP|External IP|??External IPV6??||GUID

    Should I construct that string manually via looking up the local IP information and getting the facilitator GUID then just concatenating all of it into a string and setting it as the value in manager.matchName? Or is there an existing function that can return it pre-constructed (or even something that instructs NATTraversal to just regenerate it)?

    This is how I am currently waiting for and storing that address (not the most efficient way I'd imagine):
    Code (csharp):
    1. public NATLobbyManager manager;
    2. string facilitatorConnection = "";
    3.  
    4. void Update() {
    5.     //Wait for the first instance of the network match name, then store it forever.
    6.     //Else, this server's match address information will be lost after joining any external match. (maybe better methods exist for gathering this information?)
    7.     //Note: user can not create/join any games while facilitatorConnection is an empty string and will be given a dialog warning instead.
    8.  
    9.     if (manager.natHelper.isConnectedToFacilitator) {
    10.         if (facilitatorConnection.Length == 0 && manager.matchName.Length > 0) {
    11.             //TODO Fix this and try to find where the first matchName is being generated, also might consider OnFacilitatorConnected and getting the guid there.
    12.             facilitatorConnection = manager.matchName; //get the first match that is auto generated address info from NATTraversal, hacky...
    13.             Debug.Log("just Received Address Information.\n" + facilitatorConnection);
    14.             //Now that the local NAT address is stored the user is allowed to join a match (thus changing value in matchName).
    15.         }
    16.     }
    17. }
     
    Last edited: Jun 21, 2017
  6. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    Is there a way to use just the Port Forwarding code, without having to use any of the other networking components? ie. I want to use the standard Unity Networking stack, but also use your NATHelper for its UPNP stuff? I don't think there is, as I dropped the NATHelper on a GO, and had another script querying it for isDoneFindingNATDevice and that never returned true, regardless of the time out or how long I waited.
     
  7. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    I think you just need to call findNatDevice()
     
  8. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    There's no method you can call to get that string unfortunately. It looks something like this though:

    Code (CSharp):
    1. string name = matchName + "|" + hostInternalIP + "|" + hostExternalIP + "|" + hostInternalIPv6 + "|" + hostExternalIPv6;
    2. if (connectPunchthrough) name += "|" + natHelper.guid;
    Really though you can package however much of that data you want any way you want, as long as you unpack it after getting the match name and pass what you've got in to StartClientAll().

    The internalIP comes from Network.player.ip. The externalIPs should be fetched for you by the NetworkManager. The internal IPv6 comes from getLocalIPv6() method on the NetworkManager.
     
    CloudyVR likes this.
  9. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @Eideren I've not forgotten about you.
     
  10. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @Eideren Well I'm not sure what the actual problem is, but I moved findNatDevice to the constructor of NATHelper and it sure seems faster so thanks for that tip! I'll try and get a new version up in the next couple of days.
     
  11. WaaghMan

    WaaghMan

    Joined:
    Jan 27, 2014
    Posts:
    245
    An user reported this crash shortly after connecting a game. Reading the log, he was already connected before the crash. However the user deleted the pastebin link so I only have the stack trace for the crash:

    Code (csharp):
    1.  
    2. 0x7662338D (KERNELBASE) DebugBreak
    3. 0x1010DB5D (mono) unity_mono_reflection_method_get_method
    4. 0x1010DB97 (mono) unity_mono_reflection_method_get_method
    5. 0x1010B10B (mono) unity_mono_reflection_method_get_method
    6. 0x1010B956 (mono) unity_mono_reflection_method_get_method
    7. 0x1010BA92 (mono) unity_mono_reflection_method_get_method
    8. 0x1010BBFE (mono) unity_mono_reflection_method_get_method
    9. 0x1010AC07 (mono) unity_mono_reflection_method_get_method
    10. 0x1010F210 (mono) unity_mono_reflection_method_get_method
    11. 0x1005EF4B (mono) mono_object_new_alloc_specific
    12. 0x1005FF2A (mono) mono_object_new_specific
    13. 0x06504840 (Mono JIT Code) (wrapper managed-to-native) object:__icall_wrapper_mono_object_new_specific (intptr)
    14. 0x065F22B9 (Mono JIT Code) System.Linq.Enumerable:CreateWhereIterator<object> (System.Collections.Generic.IEnumerable`1<object>,System.Func`2<object, bool>)
    15. 0x065F2201 (Mono JIT Code) System.Linq.Enumerable:Where<object> (System.Collections.Generic.IEnumerable`1<object>,System.Func`2<object, bool>)
    16. 0x065FB46D (Mono JIT Code) Open.Nat.Searcher:Receive (System.Threading.CancellationToken)
    17. 0x065FA2C9 (Mono JIT Code) Open.Nat.Searcher/<>c__DisplayClass4_0:<Search>b__0 (object)
    18. 0x065FA20D (Mono JIT Code) System.Threading.Tasks.Task:InnerInvoke ()
    19. 0x065FA08F (Mono JIT Code) System.Threading.Tasks.Task:Execute ()
    20. 0x065F9FF4 (Mono JIT Code) System.Threading.Tasks.Task:ExecutionContextCallback (object)
    21. 0x065F98ED (Mono JIT Code) System.Security.SecurityContext:Run (System.Security.SecurityContext,System.Threading.ContextCallback,object)
    22. 0x065F951B (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object)
    23. 0x065F92F3 (Mono JIT Code) System.Threading.Tasks.Task:ExecuteWithThreadLocal (System.Threading.Tasks.Task&)
    24. 0x065F8F3B (Mono JIT Code) System.Threading.Tasks.Task:ExecuteEntry (bool)
    25. 0x065F8E3D (Mono JIT Code) System.Threading.Tasks.ThreadPoolTaskScheduler:TaskExecuteWaitCallback (object)
    26. 0x065000BF (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this___object (object,intptr,intptr,intptr)
    27. 0x100F1808 (mono) mono_set_defaults
    28. 0x1005D887 (mono) mono_runtime_invoke
    29. 0x100627B7 (mono) mono_runtime_invoke_array
    30. 0x10062A4E (mono) mono_runtime_invoke_array
    31. 0x1007BB63 (mono) mono_security_set_mode
    32. 0x1007C35C (mono) mono_security_set_mode
    33. 0x1007F393 (mono) mono_thread_interruption_request_flag
    34. 0x1010C93A (mono) unity_mono_reflection_method_get_method
    35. 0x75E2336A (kernel32) BaseThreadInitThunk
    36. 0x76F69902 (ntdll) RtlInitializeExceptionChain
    37. 0x76F698D5 (ntdll) RtlInitializeExceptionChain
    38.  
    39.  
    Looks like it's crashing while jitting a linq operation in Open.Nat. I gave a look at the code on the repository, and while it looks simple it's not doing many error checks, so I'm not sure what could be happening.

    The user experienced the crash very frequently, so for now I've told him to use a launch argument that disables NAT punchthrough on the game.
     
  12. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62
    Hello, i have some issues about getting network port data from the server list. I'm trying to learn the network basics and try to create a matchmaker but i couldn't find a proper way to get each servers network port data.

    For each created game i'm using different network port. I get all current active matches to my server list, but since my network port is set to one value, i'm always joining to a specific server. I couldn't find a way to get any kind of port data from my found matches.

    I would be grateful if someone could lead me to the right direction. I'm not sure if i'm on the wrong one.

    Many Thanks.
     
  13. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62
    Also for network ports that already in use i created this script;

    if(NetworkServer.Listen(networkPort))
    {
    Debug.Log("Port Available");
    NetworkServer.dontListen = true;
    }
    else
    {
    Debug.Log("Port Not Available");
    networkPort = Random.Range(5000, 48000);
    StartCoroutine(TryToHostGameWithNewPort(5.0f));
    return;
    }

    I'm not sure if this is the best way to handle already used ports. I'm open for better solutions.
     
  14. Nanorock

    Nanorock

    Joined:
    Dec 2, 2012
    Posts:
    41
    Hello, I bought the plugin last week.
    I'm getting a nullref which prevent my client from joining:

    NullReferenceException: Object reference not set to an instance of an object
    NATTraversal.NetworkManager.OnClientSceneChanged (UnityEngine.Networking.NetworkConnection conn)
    UnityEngine.Networking.NetworkManager.FinishLoadScene () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkManager.cs:719)
    UnityEngine.Networking.NetworkManager.UpdateScene () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkManager.cs:759)
    UnityEngine.Networking.NetworkIdentity.UNetStaticUpdate () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkIdentity.cs:1092)

    I originally had a problem hosting more than one server locally. if I do that and let the client connect to the second registered server, after ~5second, the client somehow lose the connection with:
    A connection has already been set as ready. There can only be one.
    UnityEngine.Networking.NetworkManager:OnClientSceneChanged(NetworkConnection)
    NATTraversal.NetworkManager:OnClientSceneChanged(NetworkConnection)

    So I tried to bypass the plugin in case I just want to locally test. But I get the first error you can see.

    Any help ?

    Also any plan in releasing the source code ? It's always painful to work with blackboxes : (
     
    Last edited: Jun 26, 2017
  15. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62
    A connection has already been set as ready. There can only be one.
    UnityEngine.Networking.NetworkManager:OnClientSceneChanged(NetworkConnection)
    NATTraversal.NetworkManager:OnClientSceneChanged(NetworkConnection)

    I got the same problem here. I realised this happens when the client connects via Relay first and then the system converts it to Punchthrough.

    I think the system chooses the best and optimal connection type but while switching it tries to connect again with same NetworkConnection id. I'm not sure what happens on the background.

    I hope this will get fixed soon.
     
  16. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62

    By the way this issue is happening in low spec PC's mostly. I tried on better computers which works well without any issues.

    For now i fixed this issue by disabling "Relay Connection". Using Punchthrough only works well.
     
  17. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    By default the plugin packages all of the connection info in the match name, but you shouldn't even have to worry about that if you just pass the match in to StartClientAll().

    This is really the way to go anyway because the plugin uses more than just the port to connect, it also uses a guid for the punchthrough.

    If you really want to get at the port for some reason though you can parse it out of the match name using the ParseConnectionInfoFromMatchName() method.
     
  18. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Can you replicate this using the provided Example scene? If not can you send me a minimal project that does recreate the issue. Also what version of the editor and plugin are you using?
     
  19. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Sounds like the same issue @Olcay is running in to. Same questions: Can you replicate this using the provided Example scene? If not can you send me a minimal project that does recreate the issue. Also what version of the editor and plugin are you using?

    I'm digging into it but so far I can't replicate on my end (which is always frustrating).
     
  20. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    That's especially weird since most of what Open.NAT does is before connecting. I'll try and dig in to the Open.NAT code and add some error checks but you will probably get a better solution if you also report this issue to the Open.NAT devs.
     
  21. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @Olcay
    So it turns out I wasn't including the port in the rest of the connection info (as you may have noticed). I'm not sure how that slipped through so long since we also use a random port every time in our game. It looks like we just worked around it by sending it over steam lobbies. D'Oh! Next release will have the port included in the match name with the other connection info.

    @trappist-1 I just added a new method, getMatchNameFromConnectionInfo(), that you will be able to use to get that match name string.

    @Nanorock @Olcay
    I'm able to replicate the problem now so I should get to the bottom of it pretty soon.
     
  22. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    I have made some attempts at fixing this. findNatDevice() is now thread safe and gets called in the constructor of NATHelper.
     
  23. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    I unwound the linq operation and added some null checks. Not sure if I'm treating the symptom or the problem but not crashing has to be better than crashing!
     
  24. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    To All: New build is coming soon. Should be uploaded tonight.

    [edit] Just uploaded and submitted for approval. Should be on the asset store in a few days.
     
    Last edited: Jul 1, 2017
  25. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62
    I couldn't replicate the issue using the example scene. I will create a graphically heavy scene and test there.
     
  26. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62
    Also there is a problem when we create matches with passwords.

    I have tested on the example scene and the result is the same.

    This is how i created the server.
    StartHostAll("Hello World", customConfig ? (uint)(maxConnections + 1) : matchSize, true, "1234");

    This is how i join the matches.
    StartClientAll(match, OnMatchJoined, "1234");

    When i try to join the match debug logger says;

    MatchMakingClient ListMatches :https://mm.unet.unity3d.com/json/reply/ListMatchRequest
    UnityEngine.Networking.Match.NetworkMatch:ListMatches(Int32, Int32, String, Boolean, Int32, Int32, DataResponseDelegate`1)
    ExampleNetworkManager:OnGUI() (at Assets/NAT Traversal Example/ExampleNetworkManager.cs:94)

    Match list is empty
    UnityEngine.Debug:Log(Object)
    ExampleNetworkManager:OnMatchList(Boolean, String, List`1) (at Assets/NAT Traversal Example/ExampleNetworkManager.cs:34)
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

    I'm not sure if i did something wrong but this method should be working right ?
     
  27. frankalonso

    frankalonso

    Joined:
    Aug 3, 2015
    Posts:
    13
    First, I have to say your Nat Traversal solution is excellent!

    I was hoping to set up some way to display the current map/scene name in the server listing and update it when the scene changes. My thought for this was to pin it to the match name, in some format like "MatchName:MapName", unless there is a better way to store map names.

    Is there a way I could update the match name without destroying the match (kicking out all the current players) on scene change? I'm open to any alternatives too.
     
  28. erpatton

    erpatton

    Joined:
    Oct 6, 2014
    Posts:
    55
    @thegreatzebadiah I was looking to see if this works with Photon Bolt, and I noticed you sent a message to another user regarding this. Would you mind sending me the same message?
     
  29. beauhobbs

    beauhobbs

    Joined:
    May 6, 2014
    Posts:
    3
    Hey noble, as an update, is this working with NetworkLobbyManager now?
     
  30. WaaghMan

    WaaghMan

    Joined:
    Jan 27, 2014
    Posts:
    245
    An issue I think we've been having since the beginning:

    When an user leaves the game (no matter if host or client) via StopHost() / StopClient() , supposedly a disconnection event is sent automatically, so the other peers can quickly detect the disconnection and react to it appropiately.

    However, in our tests we never receive this event, and all disconnections are detected a bit late by timeout.
     
  31. KyleStank

    KyleStank

    Joined:
    Feb 9, 2014
    Posts:
    204
    @thegreatzebadiah
    So I have just purchased NAT Traversal and the example is not working. When I try to host, I get an error that says NATTraversal: Failed to create match. We'll still try and host but it doesn't look good.
    What causes this? I opened the default example and changed literally nothing.
     
  32. kscarlett

    kscarlett

    Joined:
    Jan 5, 2015
    Posts:
    3
    Hey,

    I have just added the asset to my project, and cloud build fails on all desktop platforms, while building from the editor works. This is the relevant part of the build log: https://pastebin.com/uabiVHWY. Cloud build is using Unity 2017.1b10, and my editor is 2017.1f1 (release candidate). I'm also using the experimental .NET 4.6 runtime.

    I don't know if this error is already known here or not.
     
  33. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @KyleStank you have to hook your project up to Unity's online services if you want to use the unet matchmaking.
     
  34. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
  35. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @WaaghMan I'll look into this again in a bit but I just tested the other day and I'm fairly positive that the timeout on disconnect it "intended." There's a forum thread about it somewhere where a dev explained that when you StopClient() a disconnect message is sent, but then the client is shut down in the same frame, so the disconnect message doesn't always go out. Seems like a bug to me, since it was at least working better in previous versions of unity. What you may be able to do is call client.Disconnect() first and then wait a reasonable amount of time (a couple frames?) to give it a chance to go out. This should at least reduce that number of disconnects that are treated as timeouts.
     
  36. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Yep
     
  37. KyleStank

    KyleStank

    Joined:
    Feb 9, 2014
    Posts:
    204
    Lmao, that was a noob error. I have one more question for you though. Is there any way to completely remove the ability for UNET to use Unity Relay servers? I disabled the Connect to Relay but there is still some CCU that is being used.

    If there is not way to completly prevent it, would it be possible to do a sort of direct connect? Like a player can create a game and then other players can enter his IP to join without port forwarding.

    Thank you!

    EDIT:
    Sorry about all the question, I know nothing at all about networking lol.
     
    Last edited: Jul 6, 2017
  38. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    CCU doesn't matter once you go live, you are only charged for actual bandwidth over the relay server. With Connect Relay off that will be none. You will be limited by CCU though until you go live as long as you are using Unity's matchmaking service.

    The alternative if you never want to go live or use unity's services at all is to replace Unity's matchmaking with some alternative matchmaking service or something you write yourself. Steam lobbies are a popular choice if you are releasing on Steam.
     
  39. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62
    @thegreatzebadiah I currently saw the fix build. Thank you! :)
     
    thegreatzebadiah likes this.
  40. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62

    By the way i had this issue about password protected servers not working properly. Any suggestions or fixes about it ?
     
  41. KyleStank

    KyleStank

    Joined:
    Feb 9, 2014
    Posts:
    204
    Hmmm okay. Thanks for the info man. I am really digging this Asset so far! I have ran into a couple problems but I feel it will solve most of my issues. To be honest, I do not know how to write something on my own that could handle networking. Like I have literally no idea where to even start. This is the one topic I have stayed away from entirely in my experience of programming lol.
     
  42. WaaghMan

    WaaghMan

    Joined:
    Jan 27, 2014
    Posts:
    245
    Hello, the plugin is still crashing for some users due to Open.Nat in the latest version. The error is different than before, so I guess the Linq statement wasn't exactly the culprit:

    Stacktrace:
    Code (csharp):
    1.  
    2.  
    3. 0x75FC338D (KERNELBASE) DebugBreak
    4. 0x1010DBEB (mono) unity_mono_reflection_method_get_method
    5. 0x1010DC25 (mono) unity_mono_reflection_method_get_method
    6. 0x1010B199 (mono) unity_mono_reflection_method_get_method
    7. 0x1010B9E4 (mono) unity_mono_reflection_method_get_method
    8. 0x1010BB20 (mono) unity_mono_reflection_method_get_method
    9. 0x1010BC8C (mono) unity_mono_reflection_method_get_method
    10. 0x1010AC95 (mono) unity_mono_reflection_method_get_method
    11. 0x1010F29E (mono) unity_mono_reflection_method_get_method
    12. 0x1005DEB2 (mono) mono_object_new_fast
    13. 0x06210340 (Mono JIT Code) (wrapper managed-to-native) object:__icall_wrapper_mono_object_new_fast (intptr)
    14. 0x063021EB (Mono JIT Code) Open.Nat.Searcher:Receive (System.Threading.CancellationToken)
    15. 0x063010A9 (Mono JIT Code) Open.Nat.Searcher/<>c__DisplayClass4_0:<Search>b__0 (object)
    16. 0x06300FB5 (Mono JIT Code) System.Threading.Tasks.Task:InnerInvoke ()
    17. 0x06300E37 (Mono JIT Code) System.Threading.Tasks.Task:Execute ()
    18. 0x06300D4C (Mono JIT Code) System.Threading.Tasks.Task:ExecutionContextCallback (object)
    19. 0x063006DD (Mono JIT Code) System.Security.SecurityContext:Run (System.Security.SecurityContext,System.Threading.ContextCallback,object)
    20. 0x063002FB (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object)
    21. 0x063000DB (Mono JIT Code) System.Threading.Tasks.Task:ExecuteWithThreadLocal (System.Threading.Tasks.Task&)
    22. 0x062FFB83 (Mono JIT Code) System.Threading.Tasks.Task:ExecuteEntry (bool)
    23. 0x062FFA3D (Mono JIT Code) System.Threading.Tasks.ThreadPoolTaskScheduler:TaskExecuteWaitCallback (object)
    24. 0x062100BF (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this___object (object,intptr,intptr,intptr)
    25. 0x100F18F9 (mono) mono_set_defaults
    26. 0x1005D868 (mono) mono_runtime_invoke
    27. 0x10062778 (mono) mono_runtime_invoke_array
    28. 0x10062A0F (mono) mono_runtime_invoke_array
    29. 0x1007BBEA (mono) mono_security_set_mode
    30. 0x1007C3E3 (mono) mono_security_set_mode
    31. 0x1007F431 (mono) mono_thread_interruption_request_flag
    32. 0x1010C9C8 (mono) unity_mono_reflection_method_get_method
    33. 0x7645336A (kernel32) BaseThreadInitThunk
    34. 0x77059902 (ntdll) RtlInitializeExceptionChain
    35. 0x770598D5 (ntdll) RtlInitializeExceptionChain
    36.  
    37.  
    To be honest, opening the DLL with ILSpy I can't be sure of what line could be the one causing the crash.
     
  43. DrZeuss

    DrZeuss

    Joined:
    Apr 9, 2013
    Posts:
    4
    Is Unity 2017.1 planned to be supported? If so, can you share a rough expectation on timescales. Thanks.
     
  44. Morderkaine

    Morderkaine

    Joined:
    Oct 22, 2016
    Posts:
    11
    Olcay -
    I got connections working using
    StartHostAll (server_hostName, (uint)maxConnections -1, true, "password", 0, 1, null);

    Then client runs
    matchMaker.ListMatches(0, 10, "", false, 0,1, OnMatchListAutoConnect);
    And in OnMatchListAutoConnect the code is
    MatchInfoSnapshot matchToJoin = matches [0];
    StartClientAll (matchToJoin, null, "none", 0, 0, false);

    Now in my case there I am trying to set a password and use a different password to connect, to make sure passwords are working, however it connects just fine!
    So its looking like passwords just don't with this system.
     
  45. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Bah. I'll take another look and see if I can make any sense of it with this latest stack trace.
     
  46. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Soon. I'll try and get it working in in the next release, but if not it will for sure be the one after that.
     
  47. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @Olcay @Morderkaine

    Sorry it's taken me a while to get back to you on the password issue, I thought it was something I was going to have to look in to so I was putting it off until I started on the next round of fixes (which would be now). But now that I think about it...passwords really are just not supported.

    The problem is that the unet match is password protected, but the whole point of the plugin is that you don't have to join the match (and thus connect via relay) in order to connect. So what's probably happening is that relay connection fails (if it's even enabled) when the password is wrong, but then either punchthrough or direct connect succeeds which has no handling for passwords.

    The bad news is that I probably will not be adding password support. It really doesn't have anything to do with NATTraversal itself, so I don't think it really belongs in the plugin. You'll just have to implement your own system, probably some sort of rpc sent right after a player connects with the password in it and if it's wrong they are immediately disconnected. I guess the other option is to implement your own matchmaking or account server or w/e so you can confirm the credentials that way before connecting. It's a shame there's not some way to verify the password with UNet without joining the match, that would really be ideal.
     
    Last edited: Jul 14, 2017
  48. Deleted User

    Deleted User

    Guest

    Will this work with the Bolt Networking ?
     
  49. BmDeveloperz

    BmDeveloperz

    Joined:
    Jul 1, 2013
    Posts:
    62
    Handling password with rpc's seems logical in this case. Anyway, thanks for the response.
     
  50. Tony-JIANG

    Tony-JIANG

    Joined:
    Feb 2, 2016
    Posts:
    7
    Excuse me, would you please respond my Email ? Thanks!