UDP request issue

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

hhd90
Posts: 67
Joined: 21 Dec 2012, 05:17

UDP request issue

Postby hhd90 » 03 Apr 2014, 04:50

I'm working with SFS Java API, and are trying to use UDP protocol to speed up communications. In most cases, everything is OK, but sometimes problems arise: Can not send UDP requests to the server, while still sending TCP requests are normal (can still chat). This makes my program stopped, but users can still chat normal. Does anyone have experience in using the UDP protocol can help me?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: UDP request issue

Postby Lapo » 03 Apr 2014, 15:36

UDP messages can fail to be received on the other hand, this is a characteristic of the protocol.
Can you describe your use case for UDP packets? How many pps (packets per second are you sending)? It seems mobile phones are not very happy to sustain too high packet rates. We have noticed this on iOS, I am not sure about Android.

Also did you check the server logs? Maybe there are related errors that might help to pin down the issue.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
hhd90
Posts: 67
Joined: 21 Dec 2012, 05:17

Re: UDP request issue

Postby hhd90 » 05 Apr 2014, 15:56

PPS in my program is 1 package/second (most UDP traffic is used to send ack packets).
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: UDP request issue

Postby Lapo » 05 Apr 2014, 16:42

I don't understand this very well. 1 packet/second doesn't require UDP. Why not using TCP?
Also UDP for ACKs? UDP packets can be lost, plus ACKowledging what? Again TCP does all of that for you and for free :)

Can you clarify?
Lapo

--

gotoAndPlay()

...addicted to flash games
hhd90
Posts: 67
Joined: 21 Dec 2012, 05:17

Re: UDP request issue

Postby hhd90 » 06 Apr 2014, 09:45

My program should run well in these conditions large latency network (2G mobile networks). So I'm trying to reduce the latency of UDP communication, as far as I know TCP packets can be delayed because it had installed congestion control mechanism. And the use of ACK is to control UDP packet loss. I installed this protocol according to ideas from the article: http://gafferongames.com/networking-for ... w-control/
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: UDP request issue

Postby Lapo » 07 Apr 2014, 08:40

What you are saying about TCP is correct, but the anti-congestion mechanism serves a very important purpose which is not to saturate the bandwidth. In a very congested situation the likelihood that UDP packets will go through are very low and by shooting more packets could make things even worse.

UDP can be helpful when you are sending lots of positional updates very fast and you can compensate for what is lost. In other words it's a brute force approach that will saturate the network and will rely on compensation algorithms handled by your code.

In the scenario you are describing it doesn't sound like a good idea. Additionally UDP is not well support over 3G/2G networks which could cause more problems.

That's my 2c. In any case if you want to go ahead with UDP please send us more information about the issue.
1) Server version in use
2) Java API version
3) Client side stack trace of the error
4) Relevant exceptions from the server's error logs
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 16 guests