The server opens a socket. This socket is used to wait for connections. The reality is that the socket the server opens is no different from any other socket; however, Java/Kotlin treat this socket differently. This is the ServerSocket class. Sockets have an IP address and a port. The port can be from 0-65535 (16 bits. However, the ports between 0-1023 are reserved for system use and applications, so choose a larger number for your port. var ss:ServerSocket? = ServerSocket (12345) Your client will attach to the server, by means of this server socket. Client will try something like: var s:Socket? = Socket (InetAddress.getByName ("198.110.204.30"),12345) which should open up an internet connection to the machine at 198.110.204.30 at port 12345. Java Code: s = new Socket (InetAddress.getByName (M),25); out1 = new PrintStream (s.getOutputStream(),true); You can read or write from a Socket. You obtain the "stream" from the socket. I wrap this in a PrintStream and than I can use all the commands in Java/Kotlin for writing to it. Print println. in1 = new BufferedReader (new InputStreamReader (s.getInputStream())); in1 is now set up for reading from the socket. Use the BufferedReader library to read bytes from this socket. Over on the server side, you need to set up another socket! The server actually has two sockets (at least) that are open. One socket is used to listen for connections. The other sockets are those connections. ss is the ServerSocket. var s:Socket? = ss!!.accept() This accepts a connection from a client. You can make input and output streams for this socket. The server and client can now communicate with each other. kotlinca executable.jar