udp server respond on the basis of the request received from the udp client
<p>I am making a UDP application in which I am able to receive the messages from udp client and sending a result back to the udp client...but now i want to set the udp server responses on the basis of the request...like for example if udp client send "Hello" message to the server then server reacts accordingly that if the client send "world" then server reacts accordingly that....In short my problem is that i am not able to read out the string which i am receiving at the server site.....this is window form application in c#</p>

<p>for example here is the code:</p>

<pre><code>        int recv;
        byte[] data = new byte[1024];


        IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, 1235);

        Socket newsocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
        newsocket.Bind(endpoint);

        MessageBox.Show("waiting for a client..");

        IPEndPoint sen = new IPEndPoint(IPAddress.Loopback, 5001);
        EndPoint tmp = (EndPoint)sen;

        recv = newsocket.ReceiveFrom(data, ref tmp);

        MessageBox.Show(" message recieved", tmp.ToString());

        MessageBox.Show(Encoding.ASCII.GetString(data, 0, recv));
</code></pre>

<p>now i want to read out the string which i am receiving at the "recv" integer by which i could able to set the responses accordingly that..Please tell me How can i do that... </p>
