Devi implementare tutto con i socket.
Dovresti intanto guardati questi

qui

e qui