Lets settle this for once and for all :-) Compile & run the attached file, it tests different read and write functions on winsock sockets. My results are below.
OS: Windows 7 pro 64-bit Toolchain: MinGW32, GCC 4.5.0 Build command: gcc sockwrite.c -o sockwrite.exe -lws2_32 crt write() : failure (-1) - Invalid argument (22) winsock send() : success (20) winapi blocking WriteFile() : failure ( 0) - Unknown error (87) winapi overlapped WriteFile() : success (20) crt read() : failure (-1) - Invalid argument (22) winsock recv() : success ( 5) winapi blocking ReadFile() : failure ( 0) - Unknown error (87) winapi overlapped ReadFile() : success ( 5) Preliminary interpretation: If anyone gets a blocking ReadFile/Writefile that succeeds, differences between windows versions are the culprit. If crt read/write works, it must be due to CRT differences unless blocking ReadFile/WriteFile also succeed. - Bert > -----Oorspronkelijk bericht----- > Van: [email protected] > [mailto:[email protected]] > Namens Marc Lehmann > Verzonden: donderdag 9 december 2010 10:57 > Aan: W.C.A. Wijngaards > CC: [email protected] > Onderwerp: Re: Mingw doesn't like write() to socket > > On Thu, Dec 09, 2010 at 10:39:11AM +0100, "W.C.A. Wijngaards" > <[email protected]> wrote: > > > I don't really test much on vista, the tcp stack seems to be near > to > > > unusable on that box. > > > > On vista, sockets work much like XP, I tested that. > > Well, vista breaks (standard) perl, and broke firefox at one point, > because getsockname and getpeername don't agree on both sides of a > local > connection for example. > > I personally measured this on a connection to localhost for example: > > port of getsockname client == 53364 > port of getpeername client == 53363 > port of getsockname server == 53363 > port of getpeername server == 53365 > > I also had (verified) reports of getprotobyname or socket() failing and > many other weird issues. > > This definitely didn't happen on XP. > > That will probably not affect libev directly, but Vista and TCP/IP > don't > seem to work together :) > > -- > The choice of a Deliantra, the free code+content > MORPG > -----==- _GNU_ http://www.deliantra.net > ----==-- _ generation > ---==---(_)__ __ ____ __ Marc Lehmann > --==---/ / _ \/ // /\ \/ / [email protected] > -=====/_/_//_/\_,_/ /_/\_\ > > _______________________________________________ > libev mailing list > [email protected] > http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
sockwrite.c
Description: sockwrite.c
_______________________________________________ libev mailing list [email protected] http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
