When I use sendto() to send messages, i get the error “message too long”?
Socket tcpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
How can I find out the maximum possible size that i can send? Can I change it? What could be possible problem here?
First of all,
SendTois only used for UDP sockets. In the code snippet above, you are opening a TCP socket.SendTowon’t work with a TCP socket. Try it with a UDP socket and see if it works. Bear in mind that the maximum practical size of a UDP packet is 65,507 bytes. Generally, you want to keep UDP packets small to avoid fragmentation by the various network elements involved with their transmission.EDIT:
Use TcpClient to make your life easier.