Async WSAConnect failed on XP with error code = 2 ("File not found")


Posted on 16th Feb 2014 07:03 pm by admin

Hi all,

I have very strange bug, please help me if you can.

It is reproduced only on these conditions : WinXP, VS2005, VS2008, build in debug, execute without debugging.

On any other configuration or OS this code works fine.
Also works ok with old VC6.0.
I Tested it also on another XP just in case, same behavior.

I've isolated problematic code in a simple console application (no threads etc).
Just putting :
WSAEventSelect(...., FD_CONNECT | FD_READ | FD_CLOSE)
before WSAConnect, and WSAConnect will fail with error code 2 (means : File not found).
Which is not described in MSDN...also this is fail code when it really cannot connect (server is down or invalid).

If I remove WSAEventSelect (i.e. sync connect) all works.
If I debug code, all works.
If I put break point on WSAConnect line and run this app outside studio, then reach this breakpoint (start debugging) and step through WSAConnect WITH debugger it works....

I'm unable to find anything in the net about this strange behavior.
Also I'm trying to connect to FTP server, which works fine.
I'm attaching full code. It only test WSAConnect in async mode, nothing more.

10x,
Filip

No comments posted yet

Your Answer:

Login to answer
107 Like 25 Dislike
Previous forums Next forums
Other forums

Help pulling in 'id' with "read more" link
I'm trying to create snippets of my articles in the cms I'm creating, and then have them redirect to

Not Inserting into DB
I can't get my Add new Division form to submit to the database. Anyone see my issue?

Code: &a

Web Host List
Here is a list of web hosts that offer PHP and MySQL. It is no where near a full list, but it is mos

PHP and Javascript
Hello Everyone,

I have a page that needs a javascript code to be written between PHP code but

Backflush
I am looking for a report in SAP that would give me a list of all parts that are populated with a ba

do while conditions
i want to display 6 images in a 2x3 table
now what would be the correct logic to
count that th

DOMDocument
Hello All,

I need to take an XML document, modify some of the nodes in it and then perform a

Send current URL in URL with a $_GET variable problem.
Hello community,

I have created a function that gets the current variable of a page, example:

Passing JS to PHP
So I have the following
Code: <?php
getdetails(?><script type="text/

Displaying returned XML in another PHP page
I have an online payment form that will return XML given if a payment is successful or declines. I

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash