I'm new to socket programming, and the assignment that I have to do with Server/Client socket programming which I have to write server and client programs to send text across Transport Service Access Points (TSAPs) also known as TCP ports or Sockets. Your program can select any non-privileged port (that is, the port number should be greater than 1024).
When tranferring a file you should use a connection-oriented link. The protocol used for this is TCP sockets. Suppose you are tranferring information back and forth like in case of a chat program, you could use the UDP protocol. Communication occurs between two hosts through a socket (end point or port). You should use a port address between 1025-65535.
For example: ServerSocket servSock = new ServerSocket(1025);
Put the server into a waiting state:
Socket link = servSock.accept(); In this example the server will listen for a connection from client on port 1025.
Setup input and output streams.
Send and receive data.
Close the connection