13-05-2013, 04:18 PM
Write a program using socket programming for TCP preferably in C.
Principle/Theory:
Implement the Inter Process Communication (IPC) using Socket Programming
In this assignment you will implement an Echo Server. In which from the client process you will send some string to the server. And in response the server process will send the same string to the client process (i.e. Echo Server).
Steps for Implementation of TCP Socket (Server)
1. Create a socket with the specification of the port number
2. Listen to that port with listen method of the socket.
3. When there is a request for connections then accept the connection using accept method of the socket.
4. Read and write to the socket using DataInputStream and DataOutputStream respectively.
Steps for Implementation of TCP Socket (Client)
2. Create a socket with the specification of the host machine (server) and the port number.
3. Specify DataInputStream and DataOutputStream for reading and writing to the Socket.
4. Write data using UTF8 encoding with writeUTF8( ) method.