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?
Thanks,
Phil
-----Original Message-----
From: wine-devel-bounces at winehq.org [mailto:wine-devel-bounces at winehq.org] On
Behalf Of Phil Lodwick
Sent: Wednesday, February 01, 2006 4:14 PM
To: wine-devel at winehq.org
Subject: select behavior different with wine
Greetings,
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_ZERO(&readfds);
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");
else
printf("THIS IS WINDOWS\n");
}
else printf("got a socket error\n");
closesocket(fd);
}
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 2270 bytes
Desc: patch.diff
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20060207/9ec3bb2c/patch.obj
More information about the wine-devel
mailing list