select behavior different with wine

Phil Lodwick Phil.Lodwick at EFI.COM
Tue Feb 7 09:31:01 CST 2006

I have attached a patch that fixes this problem for me.  Does anybody want to
comment on it before I submit it.  Is there a better way?


-----Original Message-----
From: wine-devel-bounces at [mailto:wine-devel-bounces at] On
Behalf Of Phil Lodwick
Sent: Wednesday, February 01, 2006 4:14 PM
To: wine-devel at
Subject: select behavior different with wine


I ran across a problem that the following code demonstrates.  I believe it is
due to the different definition of select on Windows vs Linux.  Before I
start to think about how to fix this in Wine, I was wondering if anybody has
already thought about the problem.

#include "stdafx.h"
#include <winsock2.h>

int _tmain(int argc, _TCHAR* argv[])
  SOCKET fd;
  WORD wVersionRequested;
  WSADATA wsaData;

  wVersionRequested = MAKEWORD( 2, 2 );
  WSAStartup(wVersionRequested, &wsaData);
  fd = socket(AF_INET, SOCK_STREAM, 0);
  if (fd != INVALID_SOCKET)
    fd_set readfds;
    struct timeval select_timeout ;

    FD_SET(fd, &readfds) ;
    select_timeout.tv_sec=2 ;
    select_timeout.tv_usec=0 ;

    if (select((int) fd+1, &readfds, NULL, NULL, 
      &select_timeout) != SOCKET_ERROR)
      if(FD_ISSET(fd, &readfds))
        printf("THIS IS WINE\n");
        printf("THIS IS WINDOWS\n");
      else printf("got a socket error\n");

  return 0;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 2270 bytes
Desc: patch.diff
Url :

More information about the wine-devel mailing list