Author Topic: Making Example Menu work with a phone used as both hotspot and client  (Read 2202 times)

vinzer

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
Hi! I'm trying to make TNet's example menu work using a phone as a wifi hotspot (mobile data turned off) and making the phone act as a host and player at the same time. Broadcasting to other phones connected to it via wifi works well, they can see the hotspot phone broadcasting the new server. When those other phones start their own local servers, though, the hotspot phone cannot see those created servers on its end.

I checked the packets the hotspot phone gets, and the packets contain an error "Network is unreachable".

This is specific to a phone acting as a hotspot and attempting to be a player as well.

Everything else works well, though, I'm just hung up on the discovery process. I'm hoping to recreate the functionality of the Spaceteam app, where players can hook up to another player with a phone hotspot and they all can play with each other.

Any help would be appreciated, thanks! :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Making Example Menu work with a phone used as both hotspot and client
« Reply #1 on: November 25, 2015, 06:27:00 PM »
I'd be surprised if wifi hot spots supported all the features of a local network, especially considering the variety of devices out there. Discovery over LAN works via either broadcasts or multicasts, depending on whether you're using an iOS device or something else. You can force it via TNet.UdpProtocol.useMulticasting = true/false.

When playing with friends, even if broadcasts don't work you can just display the local address on the screen somewhere (TNet.Tools.localAddress), and other players can type it in to connect. TCP always works as expected. Broadcasts use UDP, which may or may not work.

vinzer

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Making Example Menu work with a phone used as both hotspot and client
« Reply #2 on: November 25, 2015, 11:16:41 PM »
Thanks for the clear explanation. This is helpful in determining the scope of the project my team will be making. :)