Creating of Events for Socket communication. RRS feed

  • Question

  • I am trying to create events for socket communication. Two events are created for reception of messages on two different sockets. But in real time during commuincation messages are received at one socket continuously (for eg socket A), most of the time and rarely on the other socket (socket B). Both are monitored in same thread using WaitforMultipleobjects  function with bWaitAll = FALSE and dwMilliseconds = INFINITE..

    While testing I found the event which was created for receiving messages from socket B continuously waits until a message is received in socket B even though socket A is receiving the messages it cannot be read. This is because reading part of code does not get executed as the control returns from the thread from recvfrom function (called for reading socket B message) directly.

    Any reason for such behavior  or alternate solution for event based socket communication?

    Monday, February 10, 2014 9:54 AM