WSK not receiving first datagram

I am doing client TFTP (UDP) in the kernel (WSK), and am finding that the first packet is almost always dropped. This happens for any of:
. enabling receive callback on socket
. enable receive callback for all sockets
. not using callbacks but pending ReceiveFrom calls instead

What I am seeing is:

  1. Open socket
  2. From open socket completion routine, bind to ephemeral port
  3. From bind completion, SendTo the RRQ packet to the TFTP server
  4. Timeout waiting for OACK packet
  5. Resend the RRQ packet
  6. Receive OACK packet as expected

Wireshark shows that the first RRQ packet definitely hits the server, and the server definitely sends the OACK packet, but WSK never receives it.

So it’s behaving as if there is a delay between binding the socket and when receive starts to work.

What might the problem be?

Thanks

James

Does the same issue occur for a similar UM WinSock client?

Cheers,
Dave Cattley

Sent from my Windows Phone


From: James Harpermailto:xxxxx
Sent: ‎11/‎8/‎2015 1:28 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] WSK not receiving first datagram

I am doing client TFTP (UDP) in the kernel (WSK), and am finding that the first packet is almost always dropped. This happens for any of:
. enabling receive callback on socket
. enable receive callback for all sockets
. not using callbacks but pending ReceiveFrom calls instead

What I am seeing is:
1. Open socket
2. From open socket completion routine, bind to ephemeral port
3. From bind completion, SendTo the RRQ packet to the TFTP server
4. Timeout waiting for OACK packet
5. Resend the RRQ packet
6. Receive OACK packet as expected

Wireshark shows that the first RRQ packet definitely hits the server, and the server definitely sends the OACK packet, but WSK never receives it.

So it’s behaving as if there is a delay between binding the socket and when receive starts to work.

What might the problem be?

Thanks

James


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Not sure. I’ve never written a UM Winsock application before.

I was looking for a way to tell when the socket is really ready to accept packets, but the further testing I’ve done says that the socket is not ready to accept packets for at least 0.8ms after the bind is complete, and could be much higher (this is the lower limit according to wireshark).

So instead I’m pre-allocating and binding sockets, which should solve this problem.

Thanks

James

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Dave Cattley
Sent: Monday, 9 November 2015 1:04 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] WSK not receiving first datagram

Does the same issue occur for a similar UM WinSock client?

Cheers,
Dave Cattley

Sent from my Windows Phone
________________________________
From: James Harpermailto:xxxxx
Sent: ‎11/‎8/‎2015 1:28 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] WSK not receiving first datagram
I am doing client TFTP (UDP) in the kernel (WSK), and am finding that the first packet is almost always dropped. This happens for any of:
. enabling receive callback on socket
. enable receive callback for all sockets
. not using callbacks but pending ReceiveFrom calls instead

What I am seeing is:
1. Open socket
2. From open socket completion routine, bind to ephemeral port
3. From bind completion, SendTo the RRQ packet to the TFTP server
4. Timeout waiting for OACK packet
5. Resend the RRQ packet
6. Receive OACK packet as expected

Wireshark shows that the first RRQ packet definitely hits the server, and the server definitely sends the OACK packet, but WSK never receives it.

So it’s behaving as if there is a delay between binding the socket and when receive starts to work.

What might the problem be?

Thanks

James


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>