Ignore:
Timestamp:
Nov 4, 1999, 1:58:03 AM (26 years ago)
Author:
phaller
Message:

Socket experiments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wsock32/async.cpp

    r1468 r1587  
    1 /* $Id: async.cpp,v 1.10 1999-10-27 08:38:03 phaller Exp $ */
     1/* $Id: async.cpp,v 1.11 1999-11-04 00:58:03 phaller Exp $ */
    22
    33/*
     
    3232#include <sys/ioctl.h>
    3333#include <sys/select.h>
     34#include <sys/time.h>
    3435
    3536#include <wsock32const.h>
     
    6061                       fd_set *,
    6162                       fd_set *,
    62                        struct timeval);
     63                       struct timeval*);
    6364
    6465// wsock32.cpp: error code translation
     
    10021003
    10031004  // finally do the select!
     1005#ifndef BSDSELECT
    10041006  irc = os2_select(&sockWin,
    10051007                   (ulEvent & FD_READ)  ? 1 : 0,
     
    10071009                   (ulEvent & FD_OOB)   ? 1 : 0,
    10081010                   10000);              // @@@PH timeout
     1011#else
     1012
     1013  // BSD implementation
     1014  fd_set fds_read,     *pfds_read      = &fds_read;
     1015  fd_set fds_write,    *pfds_write     = &fds_write;
     1016  fd_set fds_exception,*pfds_exception = &fds_exception;
     1017  struct timeval tv;
     1018
     1019  FD_ZERO(&fds_read);      FD_SET(sockWin,&fds_read);
     1020  FD_ZERO(&fds_write);     FD_SET(sockWin,&fds_write);
     1021  FD_ZERO(&fds_exception); FD_SET(sockWin,&fds_exception);
     1022
     1023  tv.tv_sec  = 10;
     1024  tv.tv_usec = 0;
     1025
     1026  if (!(ulEvent & FD_READ))  pfds_read      = NULL;
     1027  if (!(ulEvent & FD_WRITE)) pfds_write     = NULL;
     1028  if (!(ulEvent & FD_OOB))   pfds_exception = NULL;
     1029
     1030  irc = bsd_select(sockWin+1,
     1031                   pfds_read,
     1032                   pfds_write,
     1033                   pfds_exception,
     1034                   &tv);
     1035#endif
     1036
    10091037  if (irc < 0)                                          /* an error occurred */
    10101038  {
     
    10291057      irc = ioctl(sockWin, FIONREAD, (char *)&iUnknown, sizeof(iUnknown));
    10301058      if ( (irc == 0) && (iUnknown > 0))
    1031          usResult |= FD_READ;
     1059         usResult |= FD_READ | FD_CONNECT;
    10321060    }
    10331061
Note: See TracChangeset for help on using the changeset viewer.