Search Unity

  1. We have added sub-forums for the experimental MLAPI and Unity Transport Package. Please use the new forums to discuss related topics.
    Dismiss Notice

Could not bind socket in Android when using Unity Transport package

Discussion in 'Unity Transport' started by arielsan, Aug 27, 2020.

  1. arielsan

    arielsan

    Joined:
    Dec 3, 2013
    Posts:
    45
    Hi, I am having problems when using transport package in android for my game client, it says the following exception:

    Code (CSharp):
    1.  
    2. AndroidPlayer(ADB@127.0.0.1:34999) Exception: Could not bind socket
    3.   at Unity.Networking.Transport.BaselibNetworkInterface.Initialize (Unity.Networking.Transport.INetworkParameter[] param) [0x00107] in C:\workspace\NaiveNetworkGame\Client\Library\PackageCache\com.unity.transport@0.4.0-preview.3\Runtime\BaselibNetworkInterface.cs:197
    4.   at Unity.Networking.Transport.NetworkDriver..ctor (Unity.Networking.Transport.INetworkInterface netIf, Unity.Networking.Transport.INetworkParameter[] param) [0x00079] in C:\workspace\NaiveNetworkGame\Client\Library\PackageCache\com.unity.transport@0.4.0-preview.3\Runtime\NetworkDriver.cs:480
    5.   at Unity.Networking.Transport.NetworkDriver.Create (Unity.Networking.Transport.INetworkParameter[] param) [0x00001] in C:\workspace\NaiveNetworkGame\Client\Library\PackageCache\com.unity.transport@0.4.0-preview.3\Runtime\NetworkDriver.cs:454
    6.   at Client.ClientNetworkSystem+<>c__DisplayClass0_0.<OnUpdate>b__0 (Unity.Entities.Entity e, Client.NetworkManagerSharedComponent managerSharedComponent, Client.ClientStartComponent& s) [0x00021] in C:\workspace\NaiveNetworkGame\Client\Assets\Scripts\Client\ClientNetworkSystem.cs:39
    7.   at Unity.Entities.EntityQueryBuilder.ForEach[T0,T1] (Unity.Entities.EntityQueryBuilder+F_ESD`2[T0,T1] action) [0x000ea] in C:\workspace\NaiveNetworkGame\Client\Library\PackageCache\com.unity.entities@0.14.0-preview.18\Unity.Entities\EntityQueryBuilder_ForEach.gen.cs:2765
    8.   at Client.ClientNetworkSystem.OnUpdate () [0x0000e] in C:\workspace\NaiveNetworkGame\Client\Assets\Scripts\Client\ClientNetworkSystem.cs:30
    9.   at Unity.Entities.ComponentSystem.Update () [0x0005e] in C:\workspace\NaiveNetworkGame\Client\Library\PackageCache\com.unity.entities@0.14.0-preview.18\Unity.Entities\ComponentSystem.cs:107
    10.   at Unity.Entities.ComponentSystemGroup.UpdateAllSystems () [0x0009c] in C:\workspace\NaiveNetworkGame\Client\Library\PackageCache\com.unity.entities@0.14.0-preview.18\Unity.Entities\ComponentSystemGroup.cs:513
    11. UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
    12. UnityEngine.DebugLogHandler:LogException(Exception, Object)
    13.  
    Sorry for sharing all my personal folders there :S

    I checked the AndroidManifest and this permission is automatically added by Unity, so it shouldnt be the issue:

    Code (CSharp):
    1.   <uses-permission android:name="android.permission.INTERNET" />
    When I compile with IL2CPP, the exception is cleaner I believe:

    Code (CSharp):
    1. 8-26 22:22:05.044 15194-15211/com.Gemserk.NaiveNetworkGame.Client E/Unity: Exception: Could not bind socket
    2.       at Unity.Networking.Transport.NetworkEndPoint.get_LoopbackIpv4 () [0x00000] in <00000000000000000000000000000000>:0
    3.       at Unity.Networking.Transport.NetworkDriver.Create (Unity.Networking.Transport.INetworkParameter[] param) [0x00000] in <00000000000000000000000000000000>:0
    4.       at Unity.Networking.Transport.NetworkDriver.Create (Unity.Networking.Transport.INetworkParameter[] param) [0x00000] in <00000000000000000000000000000000>:0
    5.       at Client.ClientNetworkSystem+<>c__DisplayClass0_0.<OnUpdate>b__0 (Unity.Entities.Entity e, Client.NetworkManagerSharedComponent managerSharedComponent, Client.ClientStartComponent& s) [0x00000] in <00000000000000000000000000000000>:0
    6.       at Unity.Entities.EntityQueryBuilder+F_ESD`2[T0,T1].Invoke (Unity.Entities.Entity entity, T0 s0, T1& d1) [0x00000] in <00000000000000000000000000000000>:0
    7.       at Unity.Entities.EntityManagerManagedComponentExtensions.SetComponentData[T] (Unity.Entities.EntityManager manager, Unity.Entities.Entity entity, T compon
    Hope you can help me, thanks!
     
  2. FakeByte

    FakeByte

    Joined:
    Dec 8, 2015
    Posts:
    146
    Which INetworkParameter[] did you use if any?
    How are you creating the NetworkDriver?
    Is it working in the editor?
    Which unity version are you on?

    Try building it with burst turned off and see if that works, there used to be a bug with burst on on mobile in older versions.
     
  3. arielsan

    arielsan

    Joined:
    Dec 3, 2013
    Posts:
    45
    @FakeByte thanks!! it was that, I disabled burst on Android and it worked :)

    I am using default INetworkParameter and creating NetworkDriver as explained in the docs, it works on editor and using Unity2020.2.0b1
     
unityunity