I've gotten the A from a friend once again. He created a tutorial on using sockets though this'll be completely different.
First we'll import these two packages, enabling us to use certain classes (e.g Socket, ServerSocket, etc):
import java.net.*;
import java.net.*;
import java.io.*;
Now that we've imported these packages, we can use them.
Let's start with creating a new instance of the Socket class:
SocketServer socketserv = new SocketServer(5555);
The 'new' keyword makes it so you'll no longer have to call methods and what not from 'SocketServer', and now you can just use the object 'socketserv'. The integer will make it so the socketserv will only allow the connection from the port '5555'.
There are two very important methods that I'm going to explain right now, and they are:
accept() - accepts the connection.
close() - closes the connection.
There are others but I won't go into detail about them in this tutorial. More explanation will be put into this tutorial later on.