CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2012
    Location
    Edinburgh
    Posts
    20

    Time dependency on Winsock sendto

    I am running on Windows 7.

    I have a program that uses winpcap to wait for BOOTP packets to come from a destination and identify its IP address.
    It then opens a socket, call it X9, and binds it to port 9 at that IP address. This binding happens only once.

    It now sends several packets to X9 using sentto.
    These all are sent (and received at the other end) correctly.
    The program then opens, uses, and closes a couple of other sockets on different ports at the same IP address.

    I now try to repeat the original sequence, starting with a wait for BOOTP packets, but this time, I do not attempt to recreate the binding of X9; it is left in its previous state.

    This time, the sending of several packets to X9 doesn't work.
    The calls to sendto appear to work and return not an error status but the expected size of data transmitted.
    Using WireShark, I do not see any packets being transmitted.
    Everything I have looked at in relation to these transfers appears identical to the working case.

    However, if I wait 10 or 20 seconds before starting to wait for BOOTP and the rest, everything works again.

    Does anyone have any idea what may be causing this behaviour?

    I know that closing and reopening the same port can fail (explicitly with error 10048) as Windows takes its time actually to close ports.
    In this case, however, I am not closing or opening anything on port 9 after the initial open.

  2. #2
    Join Date
    Mar 2001
    Posts
    2,529

    Re: Time dependency on Winsock sendto

    Without seeing code or understanding more, I can only hazard a guess.

    Perhaps the BOOTP socket is expecting a keepalive and never getting it?

    A keepalive as you know is a packet that tells the system that communications are still good and
    to keep the socket open.

    I do not know if your system has this option at all. Without more background and code
    we can't really help more.
    ahoodin
    To keep the plot moving, that's why.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured