You might want to think about developing a threading solution to this problem otherwise you will get clicks in the sound.
As you want your audio stream to be running all the time
You should try and develop a client server solution inside the phone.
You could make a connection to the socket server in the client thread and receive the packets and the transfer them to your own server which is interfacing to the outputstream . You need to buffer some data for the latency and you should get constant sound.
The server could run as a process or just a thread. In order to pass the packets to the server if your running as a process you will need to copy the data or if its running in a thread you could just pass a pointer to the buffer in the request parameters of the send and receive function
Or you could bypass the server idea and do everything in your own threading . If you do DONT FORGET which thread called you etc otherwise you will get ownership problems with sessions etc,,