how to convert from UDP to TCP? For example I'm used this code for UDP:
Socket peer1 = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
UnicodeEncoding coding = new UnicodeEncoding();
byte[] pp = coding.GetBytes(ping);
peer1.SendTo(pp, receiverIp);
peer1.SendTo(txtBuf, txtBuf.Length, SocketFlags.None, receiverIp);
How to write it use TCP protocol??? Because my code is large, I only want some of codes change.
And another question:
How to define maximum buffer on receiver when I received packet for UDP and TCP?