If you are working with IP addresses and ports, take a look at using the ServerSocket and Socket classes.