This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

out-of-order arrived packets

0

I have 2 client applications on c#, one is comercial with non-open-code, and one is mine.

Both connect to the sever via tcp, and make simple stuff: get packet from server, analyze it, send another packet back to the server.

I try to compare the speed, by running same time on one machine with same priority. And get very strange thing:

Packet for mine application send first from the server, and a few us later a packet for commercial app is sent. But on the wireshark dump I see that first packet arrives later for 60-150 us then the second one.

Could you please be so kind to help me to find why? How wireshark messure the time for packet arrival? Could I somehow block the socket and make delays that's way?

Thank you in advance!

Socket part of the app:

 private Socket _socket;
    private byte[] _buffer;
    public void Start(IPEndPoint endpoint)
    {
        _buffer = new byte[1024];
        _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
        {
            NoDelay = true,
            ReceiveBufferSize = 1024
        };
        _socket.Connect(endpoint);
    _socket.BeginReceive(_buffer, 0, _buffer.Length, SocketFlags.None, OnReceive, null);
}

private void OnReceive(IAsyncResult result)
{
    var recieved = _socket.EndReceive(result);

    ProcessReceived(recieved);

    _socket.BeginReceive(_buffer, 0, _buffer.Length, SocketFlags.None, OnReceive, null);
}

private void ProcessReceived(int recieved)
{
    // process received data
}</code></pre></div><div id="question-tags" class="tags-container tags"><span class="post-tag tag-link-tcpdump" rel="tag" title="see questions tagged &#39;tcpdump&#39;">tcpdump</span> <span class="post-tag tag-link-out-of-order" rel="tag" title="see questions tagged &#39;out-of-order&#39;">out-of-order</span> <span class="post-tag tag-link-packet" rel="tag" title="see questions tagged &#39;packet&#39;">packet</span></div><div id="question-controls" class="post-controls"></div><div class="post-update-info-container"><div class="post-update-info post-update-info-user"><p>asked <strong>26 Jun '14, 03:57</strong></p><img src="https://secure.gravatar.com/avatar/3b3c4174707af1f6d3897af1191604ed?s=32&amp;d=identicon&amp;r=g" class="gravatar" width="32" height="32" alt="rev3n&#39;s gravatar image" /><p><span>rev3n</span><br />

11113
accept rate: 0%

edited 26 Jun ‘14, 04:20

grahamb's gravatar image

grahamb ♦
19.8k330206

We’ll need some more info. Is there ARP going on? How did you measure transmit timings? Where did you measure the receive timings?

(26 Jun ‘14, 05:37) Jaap ♦

Sorry, I don’t know what to answer you about ARP, it is tcp/ip over Ethernet connection via 10G line (machine - switch - server). About transmit timings, I did not measure it, server generate packets consistently, so I expect delay between them not more then 10s us. Receive timings I measured by WireShark.

(26 Jun ‘14, 06:15) rev3n