Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

MIRROR: Connect Android client to PC server?

Discussion in 'Connected Games' started by tanmayband, May 17, 2019.

  1. tanmayband

    tanmayband

    Joined:
    Nov 20, 2018
    Posts:
    3
    Using the Mirror NetworkManager alongwith the NetworkManagerHUD, I made two scenes: one for server, one for client. I tested connecting the client to the server on the same machine (by building out the client scene to Windows) and it works.

    Then.I built out the client scene to Android, and started up the server one on laptop, both devices being connected to the same home wifi. I entered the relevant IP and port on the client phone, and when I hit LAN Client on the phone, it can't connect to the laptop server, and times out and gives

    Client Recv: failed to connect to ip=192.168.x.xx port=xxxx
    reason=System.Net.Sockets.SocketException (...) Connection timed out at 
    System.Net.Sockets.TcpClient.Connect.....


    I tried setting the relevant ports to 'allow' in the firewall, to no avail. How can I go about achieving this?
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    5,518
    You're referring to the software firewall on the laptop, correct? And the server build isn't itself blocked right?
     
  3. tanmayband

    tanmayband

    Joined:
    Nov 20, 2018
    Posts:
    3
    Yeah, I meant the default Windows firewall. And I haven't built the server one, I just run it from the editor. How do I know if it's blocked or not? Something in the firewall screenshot I uploaded?
     

    Attached Files:

  4. tanmayband

    tanmayband

    Joined:
    Nov 20, 2018
    Posts:
    3
    I got it, my server (windows laptop) firewall was blocking the connection. Even though I had put in an "Allow" rule in Inbound rules, there's apparently Unity editor's own "Block" rule, that blocks any type of connection over TCP and UDP. Had to disable those rules, and it finally worked.

    Later, when I built out the server scene, windows popped up the "Firewall is blocking some features" dialog, I simply clicked Allow and it worked.
     
    Joe-Censored likes this.