|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
Defines communications Transmitting the data packet, packet text needs to be sent after the end of the ACK confirmed that the ACK packets are usually in response to back fringe, if no response packet will be sent back to the time delay of 0.2 seconds. ACK can be confirmed only after the transmitter sending the next message, if the text had to send two packages, there is always a delay of 0.2 seconds, and how to eliminate this delay?
Which heroes know that this what the next grateful! |
Defines communications Delay can you not? |
Defines communications I think we can not go anywhere, because this is related to tcp, perhaps the revised code can achieve the tcp :)
In the application layer together made a bar fight two packages, or add a transmission queue, the data packets are sent to throw them, the contract has been open thread |
Defines communications Open thread has been letting contracts and would not improve the speed!
Or between two packages : a delay of 0.2 seconds - (
100 packets will continue to give more than 20 seconds! |
Defines communications What are you in the end? This is 0.2 seconds, you set up your own procedures, or TCP itself is the cause? If your program is, how do you want it?
TCP itself should not these restrictions, you should try to set up TCP_NODELAY.
In addition, because you have to be confirmed before sending the next ACK messages, such efficiency is not high, not too fast speed, and the journey time is inversely proportional basically.
Faint! This means 0.2 seconds from the time you not? If it is, then the only so fast. Unless agreement is not allowed to be sent on a ACK received news that the asynchronous mode. |
Defines communications TCP concern when you do not use these details, if you want to achieve your personal description of the process, it should use UDP.
Note : In fact, your network and the process is a "stop-and-wait" TCP does not work, but variable length sliding window protocols. |
Defines communications JohnBull withheld sounds very right.
I should add a few words.
| Defines communications On this question, I suggest that you look at the TCP Xiangxie have I, or UNIX network composition I, I remember seen, but forgotten. |
Defines communications In the transmitter installed NO_DELAY
In response to receiving terminal installed TCP_QUICKACK |
Defines communications Upstairs : setsockopt have TCP_QUICKACK option?
I did not report UNIXWARE7.1.3 environment.
Explain is simple : I used the Socket Communications, under the SCO OPENSERVER When the packet length of the text "of the five will still be 0.2 seconds delay, but the length of" 1955 1987. In UNIX nothing to do with the packet size of the text, as long as there is no response packet, the delay will be. |
Defines communications
| Defines communications Whenever I visit hide guess time will find that I have not forgotten all the knowledge learned! |
Defines communications -->
In OPENSERVER TCP_NODELAY not support the UNIX set up a useless |
Defines communications --> |
Defines communications Message sent in a long time connections sent a first length, for the sake of writing for calling a library function. Prototype :
Int PutMessage (int nSock, char *strBuff, int nLen);
StrBuff data to be transmitted, without length. So this will become sent :
Sprintf (temperature, "%05d" nLen);
Write (nSock, temperature, 5);
Write (nSock, strBuff, nLen);
Will be twice the write operation.
This can only be changed now
Char *temp;
Temperature = (char *) malloc (nLen+6);
Sprintf (temperature, "%05d" nLen);
Memcpy (temp+5, strBuff, nLen);
Write (nSock, temperature, nLen+5);
Feeling very quickly! |
Defines communications -->
Ha Ha Ha!
I really said was : China :
[code]write (NSock, temperature, 5);
Write (nSock, strBuff, nLen) ;[/code]
And
[code]write (NSock, temperature, nLen+5) ;[/code]
The effect is the same!
Yes,
[code]write (NSock, temperature, 5) ;[/code]
Indeed would be delayed transmission.
However, you should be aware of :
[color=blue]1 Delay what is the reason? [/color]
[color=red] Because Nagle algorithm optimization results. [/color]
[color=blue]2, Nagle algorithm optimization What is the goal? [/color]
[color=red] Is a small amount of data transmission in order to prevent the waste of network bandwidth. (Note 1) [/color]
[color=blue]3, Nagle algorithm to achieve a what will be the effect? [/color]
[color=red]Nagle Algorithm can be a small delay in sending messages until : (1), all have been sent to a small confirmation; (2), all the accumulated data to be transmitted together, is no longer a "small group". [/color]
Conclusion :
[code]write (NSock, temperature, 5) ;[/code]
Indeed may be delayed.
But because you then have a
[code]write (NSock, strBuff, nLen) ;[/code]
Therefore, the two write TCP will eventually transfer the data to a TCP were sent out in a fight!
In other words, and you
[code]write (NSock, temperature, nLen+5) ;[/code]
The results are almost identical!
Note 1 :
TCP Packet header as a part of the IP header plus a total of 100 bytes.
Therefore, only the five bytes sent, as a small group is a waste of bandwidth. |
Defines communications Finally, take this sentence a gift that I have given :
--> |
Defines communications However, the situation has not been so simple. . .
I tried sending 200 bytes in the message, sent when a row will delay
After sending the text in a packet, the receiver can receive it immediately, the delay in receiving the second packet language.
The actual process is as follows :
The first message sent, the receiver receiving correct; Then the receiver should respond to ACK the transmitter to reduce the number of packets exchanged text, ACK and did not immediately issued, and were reportedly attempting to respond by sending attached; Since that time no response packet, the receiving terminal in 0.2 seconds after the mandatory waiting to respond to ACK
Issued a transmitter receiver waiting for the ACK packets after the text recognized that in the second packet transmission can not wait for confirmation before the text 2/d seconds later, then received confirmation ACK packets sent a second text
By TCP "sliding window" theory, the transmitter can be received prior to the issuance of a second ACK message, I do not know why not play a role.
Are now trying to find a solution so that the receiver immediately respond to ACK, or "sliding window" Onset |
Defines communications TCP_QUICKACK should be able to play such a role, but does not support UNIX
Nagle algorithm is sending a number of packages text, the text if small, and together they will be sent, the algorithm can TCP_NODELAY failure, regardless of TCP packet size of the text immediately sent.
If two packets sent here the text is a time gap between that packets sent a text and then do some other operation, and then send a second packet text, a package if the text is too small, according to Nagle algorithm of this package may not be the text sent immediately, but wait for the next one package together with the text sent to improve efficiency.
But the current situation is not the case. |
Defines communications -->
[color=red] Accordance with the TCP standard,
This is not the case. [/color]
Perhaps your analysis is wrong?
Or UNIX to achieve?
Not know.
I suggest you use TCPDUMP observation.
In the end that is not your situation.
Unfortunately I do not test conditions. |
| |