Current post is on how to overcome 500 millisecond (ms) delay in 'ACK' acknowledge of send command in TCP/IP in Visual Studio (VS) Visual C++ (VC++) Application
Is your application sending lot of small data packets in large frequency over TCP/IP sockets in Visual Studio (VS) Visual C++ (VC++) Application??
If the answer is YES, copy the following lines of code after the 'bind' function call to improve the performance of the application:
Disable the Nagle Algorithm:
int value = 1;
setsockopt(, IPPROTO_TCP, TCP_NODELAY, (char *)&value, sizeof (value));
Note:-
1. Application should be able to handle short and large number of TCP/IP socket calls
2. Network Traffic will increase as the underlying protocol won't wait for threshold bytes before sending.
Enable the Nagle Algorithm:
int value = 0;
setsockopt(, IPPROTO_TCP, TCP_NODELAY, (char *)&value, sizeof (value));
Complie. Run. Test and enjoy coding.
Appreciate your feedback via comments. Thanks.
No comments:
Post a Comment