Note that there are some explanatory texts on larger screens.

plurals
  1. POCapture server-client communication with tcpdump
    primarykey
    data
    text
    <p>I wrote a simple server and client apps, where I can switch between TCP, DCCP and UDP protocols. The goal was to transfer a file from the one to the other and measure the traffic for each protocol, so I can compare them for different network setups (I know roughly what the result should be, but I need exact numbers/graphs). Anyway after starting both apps on different computers and starting tcpdump I only get in the tcpdump-log the first few MBs (~50MB) from my 4GB file. The apps are written in a standard C/C++ code, which could be found anywhere on the web. What may be the problem or what could I be doing wrong here? </p> <p>-- <em>Edit</em></p> <p>The command line I use is:</p> <pre><code>tcpdump -s 1500 -w mylog </code></pre> <p><strong>tcpdump</strong> captures then packets <strong>only the first ~55 sec</strong>. That's the time the client needs to send the file to the socket. Afterwards it stops, even though the server continues receiving and writing the file to the hard drive. </p> <p>-- <em>Edit2</em></p> <p><em>Source code</em>:</p> <p><a href="http://pastie.org/1066833" rel="nofollow noreferrer">client.cpp</a><br/> <a href="http://pastie.org/1066837" rel="nofollow noreferrer">server.cpp</a><br/> <a href="http://pastie.org/1066840" rel="nofollow noreferrer">common.hpp</a><br/> <a href="http://pastie.org/1066843" rel="nofollow noreferrer">common.cpp</a></p> <p>-- <em>Edit final</em></p> <p>As many of you pointed out (and as I suspected) there were several misconceptions/bugs in the source code. After I cleaned it up (or almost rewrote it), it works as needed with tcpdump. I will accept the <strong>answer from @Laurent Parenteau</strong> but only for <strong>point 5.</strong> as it was the only relevant for the problem. If someone is interested in the correct code, here it is:</p> <p><em>Source code edited</em></p> <p><a href="http://pastie.org/1090272" rel="nofollow noreferrer">client.cpp</a><br/> <a href="http://pastie.org/1090273" rel="nofollow noreferrer">server.cpp</a><br/> <a href="http://pastie.org/1090274" rel="nofollow noreferrer">common.hpp</a><br/> <a href="http://pastie.org/1090275" rel="nofollow noreferrer">common.cpp</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload