13-05-2013, 04:19 PM
Write a program using socket programming for UDP 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).
Using UDP Socket
While implementing Echo server with UDP Socket you have to make use of the following classes
public class DatagramSocket
This class defines a socket that can receive and send unreliable datagram packets over the network using the UDP protocol. A datagram does not implement any kind of stream-based communication protocol, and there is no connection established between the sender and the receiver. Datagram packets are called "unreliable" because the protocol does not make any attempt to ensure that they
arrived or to resend them if they did not.
Procedure:
1. Steps for Implementation of UDP Socket (Server)
1. Create a DatagramSocket and bind to specified port.
2. Create an instance of DatagramPacket to be read from port.
3. Receive DatagramPacket from port using receive method.
4. Display received packet date.
2. Steps for Implementation of UDP Socket (Server)
1. Create a DatagramSocket.
2. Create a DatagramPacket with the specification of the Remote Host, port number and the data to be sent.
3. Send this packet using send method.