436 {
439 fd_set pollin,pollout,pollerr;
442 int port_to_listen = 80;
443 unsigned int active_fds = 0;
444
446 if(
string(
"-p" ) ==
argv[
i] ) {
449 }
450 }
451
453
456
457 while( true ) {
461 active_fds = listen_socket + 1;
462
463 for( std::map<SOCKET,RequestHandler *>::iterator
i = requests.
begin();
466 if(
i->second->ShouldDie() ) {
470 break;
471 }
472
475
476 if(
i->first > active_fds ) active_fds =
i->first + 1;
477
478 if(
i->second->WantPollout() )
FD_SET(
i->first,&pollout);
479 }
480
481 FD_SET(listen_socket,&pollin);
482
483 active_fds =
select( active_fds, &pollin, &pollout, &pollerr,
NULL );
484
485 if( active_fds > 0 ) {
486 if(
FD_ISSET(listen_socket,&pollin) ) {
490 }
491 }
492
493 for( std::map<SOCKET,RequestHandler *>::iterator
i = requests.
begin();
499 if( rv < 0 ) {
503 break;
504 }
else i->second->RecvData(
string(
inbuf, rv ) );
505 }
507 i->second->OkToSend();
508 }
513 break;
514 }
515 }
516 }
517 }
518
520}
pair< iterator, bool > insert(const value_type &__x)
void erase(iterator __pos)
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
SOCKET make_listening_socket(int port)
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
#define FD_ISSET(fd, set)
int PASCAL FAR WSACleanup(void)