Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Winsock2 woes... (Possible bug?)

PROBLEM: recvfrom is not resetting FD_READ event set with WSAEventSelect.
PLATFORM: Windows 2000 Advanced Server, Build 2195
SPECIFICS:

Socket specs:
-PF_INET (TCP/IP)
-SOCK_DGRAM (UDP)
-SO_BROADCAST

Read Loop:
-Create event using WSACreateEvent
-Register for FD_READ event using WSAEventSelect
-Enter loop
-Wait on event
-Issue a recvfrom to get data*
-Loop

*this should reset read event (if no data, which there is not), but does not
so future invocations return WSAWOULDBLOCK and the loop runs infinitely
eating up the CPU.

Miscellaneous:
-Packet that is received is sent from the same machine.
-If I use an auto reset event it appears to work okay, but this should not
be necessary according to docs (plus what if condition is still true, would
have to wait for next packet before processing previous data then)
-Same socket is used for both sends and receives (Tried using different one
as well, no luck)

I have used this same algorithm before under NT 4.0 and it seemed to work
fine. I would appreciate it if someone can confirm this as a bug or if
there is something I am doing incorrectly. Thanks...

Scott Meeuwsen
High Level Software, Ltd.

Comments

  • Update: After rereading the docs it appears I made the mistake of
    associating "reenabling" with "resetting". However, it isn't very clear.
    Do I need to reset the event manually even though I am calling a
    "reenabling" function? Thanks.

    Scott Meeuwsen
    High Level Software, Ltd.

    ----- Original Message -----
    From: "Scott Meeuwsen" <[email protected]>
    To: "NT Developers Interest List" <[email protected]>
    Sent: Tuesday, April 04, 2000 11:43 AM
    Subject: [ntdev] Winsock2 woes... (Possible bug?)


    > PROBLEM: recvfrom is not resetting FD_READ event set with WSAEventSelect.
    > PLATFORM: Windows 2000 Advanced Server, Build 2195
    > SPECIFICS:
    >
    > Socket specs:
    > -PF_INET (TCP/IP)
    > -SOCK_DGRAM (UDP)
    > -SO_BROADCAST
    >
    > Read Loop:
    > -Create event using WSACreateEvent
    > -Register for FD_READ event using WSAEventSelect
    > -Enter loop
    > -Wait on event
    > -Issue a recvfrom to get data*
    > -Loop
    >
    > *this should reset read event (if no data, which there is not), but does
    not
    > so future invocations return WSAWOULDBLOCK and the loop runs infinitely
    > eating up the CPU.
    >
    > Miscellaneous:
    > -Packet that is received is sent from the same machine.
    > -If I use an auto reset event it appears to work okay, but this should not
    > be necessary according to docs (plus what if condition is still true,
    would
    > have to wait for next packet before processing previous data then)
    > -Same socket is used for both sends and receives (Tried using different
    one
    > as well, no luck)
    >
    > I have used this same algorithm before under NT 4.0 and it seemed to work
    > fine. I would appreciate it if someone can confirm this as a bug or if
    > there is something I am doing incorrectly. Thanks...
    >
    > Scott Meeuwsen
    > High Level Software, Ltd.
    >
    >
    >
    > ---
    > You are currently subscribed to ntdev as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
    >
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Internals & Software Drivers 7 February 2022 Live, Online
Kernel Debugging 21 March 2022 Live, Online
Developing Minifilters 23 May 2022 Live, Online
Writing WDF Drivers 12 September 2022 Live, Online