Kostadin Georgiev
Kostadin Georgiev

Reputation: 895

SIP data not flushed over Android TCP socket

I have problem with socket communication - > SIP server and android devices. I can’t send SIP packet over TCP bigger than 800 bytes.If the packet is < 800 bytes everything is OK. There is a successful TCP handshake established before try to send SIP packet and still nothing. I send the data like this way;

Socket socket = new Socket(ip,port);
OutputStream out =new OutputStream(socket.getOutputStream()); 
out.flush();  
out.write(msg);  

There is no problem with send function. Strange thing is that some packets are delivered to server minutes after being send from devices for SIP packets > 800 bytes. If we try to send other data not SIP with size of packet > 800 bytes everything is OK and server receives it. The problem is only with SIP packets > 800 bytes. This problem happens not for all android devices. For example: Galaxy s plus – problem. Nexus 4 – problem. Nexus s – no problem. and etc. The issue is resolved if I split the SIP packet at two parts, however I would like to find out why SIP data isn’t flushed and other data is sent immediately. There shouldn’t be any difference.

Upvotes: 1

Views: 853

Answers (1)

nakib
nakib

Reputation: 4434

You didn't provide information about versions, but I bet you have the problem in Android's 4.0.*.

I also bet the problem only happens when you use the port 5060 over TCP.

That is a known problem in those Android versions, and the current workaround is either to update to Android 4.1(and you can't ask users to do that!) or to avoid those settings. Any other port or UDP will work.

You can find here one bug report.

Upvotes: 1

Related Questions