c# - Forcing a TCP stream to send buffer contents -
i using csharp tcp sockets send data between client , server. problem see or perceive tcp stream protocol , not push (send) data unless sufficient amount of it.
for instance wanted send data whatever doesnt matter lets 8 bytes long. behaviour seeing no matter how long wait wont send data unless push more behind presumably until reach tcp buffer.
so question is. if want send small amount of data via tcp need append garbage end force socket send. ( wouldnt feel ) or alternative way can force front segment of stream send.
thanks in advance. still learning tcp excuse ignorance.
don't set nodelay
unless expert @ tcp/ip , understand full ramifications. if haven't read stevens, don't think it.
here's example question: if establish socket connection , send 8 bytes on it, 8 bytes sent or nagle algorithm wait more data send? answer "the 8 bytes sent immediately" - don't consider messing nagle until understand why answer.
here's question: in standard command/response protocol, how nagle delay applied each packet? answer: none. again, should research why nagle causes no delays in common scenario.
if you're not seeing data sent 250 milliseconds (the maximum delay caused nagle in worst possible scenario), there else wrong.
Comments
Post a Comment