Search Unity

Android device can send data to PC, but can't receive

Discussion in 'Multiplayer' started by Zolden, Sep 15, 2019.

  1. Zolden

    Zolden

    Joined:
    May 9, 2014
    Posts:
    141
    I'm using the new com.unity.transport multiplayer thing, and it works well when I run my game on two PCs. They connect to each other without problems.

    But when I run one copy on android, and another one on PC, the following happens:

    If I run android app as client and PC one as server, android app successfully sends connect request, then server on PC accepts connection and starts the game. But android app doesn't receive "connection is accepted" signal.

    And if I start android app as server, and PC one as client, connect request from PC doesn't reach android app.

    In terms of code sending a connect request looks like this:

    Code (CSharp):
    1. m_Driver = new UdpNetworkDriver(new ReliableUtility.Parameters { WindowSize = 32 });
    2. System.Net.IPAddress ip;
    3. System.Net.IPAddress.TryParse("192.168.0.4", out ip);
    4. NetworkEndPoint endpoint = NetworkEndPoint.Parse(ip.ToString(), 9000);
    5. m_Connection = m_Driver.Connect(endpoint);
    Feels like something blocks network data from reaching android app.

    So, does anyone have any idea, what could be wrong here and how to make it so android app receive data from network?
     
  2. unity_nzbis5eDu7Js8w

    unity_nzbis5eDu7Js8w

    Joined:
    Jun 21, 2019
    Posts:
    1
    Hello,

    You posted this issue quite a long time ago, but I am running into a similar problem and I can't find out a solution.

    Did you find any workarounds?

    Thank you.
     
  3. Zolden

    Zolden

    Joined:
    May 9, 2014
    Posts:
    141
    Hey!

    Yes, I found the source of this bug. And it wasn't a result of multiplayer system misbehaving.

    There simply was a bug on android build, that I didn't notice. Some systems that worked on PC, refused to work on android. And it blocked some of the multiplayer related code from running. I don't remember what was it, something unrelated and innocent.

    So, my advice is to comprehensively debug the android build, and make sure everything works as it should, even things you wouldn't suspect in going wrong.