You mean a TCP connection?Socket socket = new Socket(InetAddress address, int port)If not a TCP connection UDP packets are supported (obviously) go checkthe Java docs.