UDP on Unity

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

JohnHacker
Posts: 5
Joined: 12 Jul 2018, 08:38

UDP on Unity

Postby JohnHacker » 20 Nov 2018, 09:10

Hi! sfs.UdpAvailable is returning false on Unity. Also if I still force sfs.InitUDP() it isn't connecting. I'm doing it on the OnLogic callback according http://docs2x.smartfoxserver.com/Advanc ... p-protocol but it still doesn't work. I couldn't find any information on similar problems and I wonder if UDP support has been deprecated because I understand it should only be disabled under WSS.

Thanks!
User avatar
Lapo
Site Admin
Posts: 21065
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: UDP on Unity

Postby Lapo » 20 Nov 2018, 17:03

Hi,
what version of the API you're using?

Keep in mind that if your export target is WebGL, UDP will not be available. Other than that it should always work.
However you must make sure that UDP is active on the server side.

1-> By default SFS2X can receive UDP messages only on the localhost (127.0.0.1). If you're testing on separate client/server machines you must open the AdminTool > Server Settings and change the UDP listener from 127.0.0.1 to 0.0.0.0

2-> UDP might be blocked by firewalls. If you run one on your server machine make sure that it allows UDP traffic on the port you've configured on the SFS2X side (default = 9933)

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
JohnHacker
Posts: 5
Joined: 12 Jul 2018, 08:38

Re: UDP on Unity

Postby JohnHacker » 22 Nov 2018, 09:06

Hi! The server is 2.13.1 and the API I had the 1.7.4 or 1.7.5. I've just tested with the last one, 1.7.10 and sfs.UdpAvailable keeps returning false. The WebSocket library is not even compiling so it shouldn't return false due to that. Unity version is 2018.2.0f2.

Thanks!
User avatar
Bax
Site Admin
Posts: 4479
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: UDP on Unity

Postby Bax » 22 Nov 2018, 09:39

Hi.
I confirm we have an issue with that UdpAvailable flag, which always returns false. We will fix this in a future API update.

Anyway, this doesn't prevent the UDP connection to be established when you call the InitUDP method after a successful login.
Are you sure this doesn't work? Do you add the OnUdpInit handler and check the "success" parameter when the event is fired?

If everything is ok on the client side and you still can't initialize UDP successfully, then there must be an issue on the server side. Did you check the configuration as Lapo suggested before?
Paolo Bax
The SmartFoxServer Team
JohnHacker
Posts: 5
Joined: 12 Jul 2018, 08:38

Re: UDP on Unity

Postby JohnHacker » 22 Nov 2018, 11:10

Hi! It works now. Thanks for the help!

Return to “SFS2X Questions”

Who is online

Users browsing this forum: JerodSa, Keganniff and 8 guests