MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / Poll

Method Poll

sourcecommon/tcpserv.cpp:107–127  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

105}
106//---------------------------------------------------------------------------
107bool MSocket::Poll(bool bread, bool bwrite, bool berror, long msec)
108{
109 Error = 0;
110 errcode = 0;
111 if( !handle )
112 {
113 Error = 1;
114 if( Exceptions ) throw 0;
115 return !Error;
116 }
117 fd_set f;
118 FD_ZERO(&f);
119 FD_SET(handle, &f);
120 timeval t;
121 t.tv_sec = 0;
122 t.tv_usec = msec * 1000; // 0 -> "POLL" SOCKET STATE and return immediately...
123 int socknumber = select(FD_SETSIZE, bread ? &f : NULL, bwrite ? &f : NULL, berror ? &f : NULL, &t);
124 if( socknumber==SOCKET_ERROR )
125 errcode = WSAGetLastError();
126 return socknumber > 0;
127}
128//---------------------------------------------------------------------------
129AnsiString MSocket::GetLocalAddr(void)
130{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected