Implementing socket communication.