0
votes

I develop custom softphone for ios. I use TCP connection as signalling. Almost everything works fine.

The problem: sometimes connection is closed from server or router side when softphone is in background mode. Softphone reestablish it - but this new connection does not seem stable; it is closed in 20-25 seconds again. It is not clear why it is closed. May iOS close such connections?

Can the TCP connection will be created in ios background mode without problem? May anyone share experience?

Thank you!

P.S. I add the pair of socket stream as needed for voip application and .plist file includes voip&audio modes.

1

1 Answers

0
votes

Discovered. I tried to create tcp socket, make it trackable by iOS and connect to host.

But the right sequence must be: 1) Create socket 2) Call connect on it 3) Wait while socket will be connected (for non-blocking sockets). I checked if socket is writeable in select() call. 4) Make socket trackable by iOS - create CFReadStream/CFWriteStream pair for this socket, set the necessary property and open read stream.

In this sequence it works.