   [TCP PROTOCOL] Buffer bigger than 2046 bytes..
  Hello to everyone,i've a question on sending package over the net. I've a server writen in c++ and winsock and IOCP. All works fine, but sometime i need to send package large than 2046 bytes. I've no problem if i use the TCP protocol, but i don't know if that's the best way to work..So anyone have some suggests? Thanks a lot and sorry for my bad english.   
Quote:Original post by Tano_ITAHello to everyone,i've a question on sending package over the net. I've a server writen in c++ and winsock and IOCP. All works fine, but sometime i need to send package large than 2046 bytes. I've no problem if i use the TCP protocol, but i don't know if that's the best way to work..So anyone have some suggests? Thanks a lot and sorry for my bad english.You can't send a packet larger than the worst-case MTU along the route the packet takes, usually around 1KB.You'll have to break larger packets into multiple smaller ones, or use a protocol like TCP which handles this itself.   ;  Infact i'm using a TCP protocol.. And i've no problem to send and recive 2046 bytes messages.. Because the TCP protocol break and merge the package itself.. But, my question is: is that the best way to send large messages with a TCP protocol?   ;Quote:Original post by Tano_ITAInfact i'm using a TCP protocol.. And i've no problem to send and recive 2046 bytes messages.. Because the TCP protocol break and merge the package itself.. But, my question is: is that the best way to send large messages with a TCP protocol?You shouldn't be using TCP if you just want to send larger messages, you should use it where you need guaranteed, in-order delivery.TCP has no concept of packets or messages, it's a stream based protocol. You could send a 1MB message if you like, TCP will break it down into packets and make sure it arrives at the other end intact.   ;Quote:You can't send a packet larger than the worst-case MTU along the route the packet takesThat's simply not true. IP fragmentation is a required, well-supported part of the standard. You should be able to send UDP packets up to 64 KB in size, just like the standard says. However, performance will go down, and the risk of packet loss goes up, because if any IP fragment is lost, the entire packet is lost.;Quote:Original post by hplus0603Quote:You can't send a packet larger than the worst-case MTU along the route the packet takesThat's simply not true. IP fragmentation is a required, well-supported part of the standard. You should be able to send UDP packets up to 64 KB in size, just like the standard says. However, performance will go down, and the risk of packet loss goes up, because if any IP fragment is lost, the entire packet is lost.Whoops you're completely right. I had some sort of brain fart there...   ;  for tcp protocol bigger send buffer means better network performance.   ;  Sorry for the off-topic comment, but I use this post to say thanks to hplus0603 for his great contribution here. I find his posts very good everytime I come to read here. Not that there aren't any other good contributors around here, but this one particularly strikes to me as being an excellent contributor. So, thank you hplus0603. I have probably learned almost all of my network programming information by reading your posts :);  Yeah thanks for your suggests =).   ;  *blush*   