Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want try to use ttcp for send udp data like below:

 echo 12345 | ttcp -tup 123 10.0.0.123 

but when I see in wireshark actually sent 5 packets in first one 12345 and in others 1234 why ?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The following process occurs:

  1. The ttcp program sends the data requested.

  2. The echo program closes the input pipe.

  3. The ttcp program shuts down the "connection", sending the additional packets that you see.

If you do (echo 12345 ; sleep 10) | ttcp ..., you'll see that it sends the data requests, and then 10 seconds later shuts down the connection sending the additional packets that you see.

This is substantially the same semantics as you'd have if you used TCP on a machine that supported T/TCP. The first packet send would be a SYN, but it would also contain the data (in the hopes that it could establish the connection and send the data in a single packet). If it got no reply, it would retransmit. (And retransmissions might not contain as much data, since the chance of success is lower, it makes more sense not to waste bandwidth.) If you tried to close the connection normally before it timed out, it would still linger, trying to establish the connection and send the data.

share|improve this answer
    
thanks and how I can perevent it? –  herzl shemuelian May 23 '12 at 12:13
    
It depends why you want to prevent it. If you just want to send raw UDP data, use something like nc. –  David Schwartz May 23 '12 at 18:43
    
in nc when i do cat filename | nc -u 1.1.1.34 223 don't back to prompt –  herzl shemuelian May 24 '12 at 8:35
    
This actually looks like a bug in nc! It does a shutdown(SHUT_WR) on the socket and then appears to expect the other side to complete the shutdown (like in TCP), which of course doesn't happen for UDP. –  David Schwartz May 24 '12 at 12:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.