Home > other >  Do chat feature, simply use the UDP protocol low success rate?
Do chat feature, simply use the UDP protocol low success rate?

Time:09-30

Is like that, now write a similar to a chat program, with pure UDP protocol processing, the success rate is too low,
(what do you want to be early UDP penetrate, make direct communication on both ends, but because both sides may use GPRS network so give up, that the road is blocked)

Server: public IP (Linux system, wrote a forwarding, database stored procedures),
Client: the Android client, a accept three threads, a sends a heartbeat


The original approach:
The client sends a UDP messages, and more than 5 seconds each other with no response, prompt timeout,
The success rate is very low,,, about 50% (timeout)


Improved a little now:
The client sends three times (every three seconds), such as 12 seconds after received response is considered overtime
Success rate slightly increased but still low timeout (30%),

Excuse me, is there any good plan, each master?
TCP + UDP is said to use QQ?
Everyone a great god no relevant ideas?
  • Related