This example includes two programs. "TCPRecv" is a simple server that receives a stream of data from the client "TCPSend". The server must be started in advance: $ java TCPRecv Port: 32874 It will output the TCP port number on which it is listening. You will need this number (and the name of the machine running the server) when you start the client: $ java TCPSend elite.cl.cam.ac.uk 32874 As usual the IPv4 address 127.0.0.1 can be used to mean "this machine" if you are running both parts of the progam on the same computer. Text entered on the process' standard input stream should be sent to the server and output there.