Im doing a network listening program using Winsock which constantly listen for datagrams.. my recever thread is able to receve data using recvfrom() but in certain situation when it receves data from multiple streams into that socket, some datagrams are found missing(no fail return from recvfrom() though) while i can still see them using network monitoring tools like NetMon and wireshark.

the protocol is UDP, i set MTU size of 1500 for the recvfrom() buffer and also tried increasing it to 5000 with no luck.. i tried blocking and unblocking modes also. help me figure out what i'm really missing here and why i'm missing packets. interestingly recvfrom never fails too..

here's a snippet of my receiving code.


Code:
.
.
SOCKET RecvSocket;
sockaddr_in RecvAddr;

unsigned short u_listenport = 6088;
.
.
RecvSocket = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
if( RecvSocket == INVALID_SOCKET )
{
    printf( "SOCKET ERROR.\n" )
    return;
}

RecvAddr.sin_family = AF_INET;
RecvAddr.sin_port = htons( u_listenport );
RecvAddr.sin_addr.s_addr = htonl( "192.135.0.1" );

if( bind( RecvSocket, (SOCKADDR *) &RecvAddr, sizeof(RecvAddr) ) != 0 )
{
    printf( "BIND Failed.\n" );
    closesocket( RecvSocket );
    WSACleanup();
    return;
}
and, the following code runs in a seperate thread.

Code:
void FunctorListenUDP( void *argptr )
{
    char RecvBuf[1500];
    while( !b_quit )
    {
        memset( RecvBuf, 0, 1500 );
        int result = recvfrom( RecvSocket, RecvBuf, 1500, 0, (SOCKADDR*) &SenderAddr, &SenderAddrSize );
        if( result == SOCKET_ERROR) 
        {
           printf( "SOCKET Error in recvfrom.\n" )
           continue;
        }

        my_app_callback_for_data( RecvBuf, result );
    }

    closesocket( RecvSocket );
    WSACleanup();
}
please help me solve this problem, this is a confusing problem and i'm not very wellinto winsock programming. i tried many things myself before posting this here. thanks in advance.