This continues to occur for an infinite amount of time until a valid event occurs on the corresponding socket. Then again, it goes back to normal behavior. Unable to trace the trigger for this issue.
What other events should I look for in the sockets other than the events I have registered for and why? I have currently registered for POLLIN & POLLHUP.
while ( 1 )
{
//Calling POLL Function;
//Sockets in List ( One Server Socket TCP )
//Sockets of Open TCP Connections
int rv = poll ( ufds , nfds , - 1 );
if (rv == -1)
{
//Error Occured in POLL
}
else if ( rv == 0 )
{
//Time out fromData Recieved
}
else if ( rv > 0 )
{
//Look for events POLLIN or POLLHUP and act correspondingly
}
}
(MOST POSSIBLE)Trigger for the issue -
//Called by Main Thread when another thread is
//polling on the respective socket_fd
recv(socket_fd, buffer, 1024, MSG_PEEK | MSG_DONTWAIT);
I am doing a MSG_PEEK to see whether the peer connected to this socket is alive.