Sample1(TCP Server/Client)

I have placed a sample code for Server and client implementation at Sample1
In the sample application, server echoes what it receives from Client. Server can handle multiple clients.

Copy Server.java and Client.java to your machine

Compile the files and run them:
1) javac Server.java
2) javac Client.java
3) java Server

You can now open a new terminal and start your client (java Client) in new terminal
Whatever message you type at client will be reflected on server. You can also try running multiple clients.

Sample2(UDP Server/Client)

I have placed a sample code for Server and client implementation at Sample2
In the sample application, server echoes what it receives from Client and sends back the capitalised message to client. Server can handle multiple clients.

Copy UDPServer.java and UDPClient.java to your machine

Compile the files and run them:
1) javac UDPServer.java
2) javac UDPClient.java
3) java UDPServer

You can now open a new terminal and start your client (java UDPClient) in new terminal
Play with it! For those who want to code in C for Programming assignments Refer "Unix Network Programming" by Richard W Stevens.