Skip navigation

Monthly Archives: November 2008

the worst job is toll taker at the toll both
– everyone’s going somewhere but you.

– alec baldwin on liptons’ actor’s studio show

Advertisements

The docs say:

10035: WSAEWOULDBLOCK.

Resource temporarily unavailable.

This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. It is a nonfatal error, and the operation should be retried later. It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established.

WTF???

wtf indeed

This error isn’t an error at all. Pay attention to the last phrase:

10035: WSAEWOULDBLOCK.

Resource temporarily unavailable.

This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. It is a nonfatal error, and the operation should be retried later. It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established.

In a program, like that crummy msdn example, I wrote:

  // Connect to server.
  if ( connect( g.s, (SOCKADDR*) &clientService, sizeof(clientService) ) == SOCKET_ERROR) {
    
    int err = WSAGetLastError();
    printf( "Failed to connect:  Error code: %d.\n", err );
    WSACleanup();
    return;
  }

But what would happen EVERY TIME is 10035: WSAEWOULDBLOCK.

WHY??? I puzzled over this again and again. WHAT IS WSAEWOULDBLOCK??
codegear has:

Abstract: Whenever I try to run my socket program, I get the error WSAEWOULDBLOCK.

Question

Why do I get a WSAEWOULDBLOCK error when I run my program.

Answer

This means that you are setting up your program as a non-blocking sockets program, however the computer is telling you that it would have to create a blocked connection to the socket.

Of all the bullshit…

THAT DOESN’T ANSWER MY QUESTION!!

So, I tried putting it in a loop to see if the state would change:

  // Connect to server.
  while ( connect( g.s, (SOCKADDR*) &clientService, sizeof(clientService) ) == SOCKET_ERROR) {
    
    int err = WSAGetLastError();
    printf( "Failed to connect:  Error code: %d.\n", err );
    //WSACleanup();
    //return;
  }

INTERESTINGLY, this is what happens:

10035
10056
10056
10056
10056
10056
10056
10056
.
.
.

Where 10056 is:

10056: WSAEISCONN

Socket is already connected.

A connect request was made on an already-connected socket. Some implementations also return this error if sendto is called on a connected SOCK_DGRAM socket (for SOCK_STREAM sockets, the to parameter in sendto is ignored) although other implementations treat this as a legal occurrence.

WHAT???? WOOHOO . . . ? ITS CONNECTED!!! BUT WHY??

Ah. I get it. Read that red italicized text again:

10035: WSAEWOULDBLOCK.

Resource temporarily unavailable.

This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. It is a nonfatal error, and the operation should be retried later. It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established.

So it would SEEM that since 10035 WSAEWOULDBLOCK is a non-fatal error, you should IGNORE IT TRY AND USE THE SOCKET ANYWAY.

If you want to use an if statement like the crummy MSDN example (which is the reason this took so long to get past!!)

  // Connect to server.
  while ( connect( g.s, (SOCKADDR*) &clientService, sizeof(clientService) ) == SOCKET_ERROR) {
    
    int err = WSAGetLastError();
    printf( "Failed to connect:  Error code: %d.\n", err );
    printf( errCodes[ err ] );
    //WSACleanup();
    //return;

    // these errors are non-fatal:  10056 means already connected
    // and 10035 means its trying really hard to connect
    // and you should just give it a moment.
    if( err == 10056 || err == 10035 )
      break;
  }

So, how do you get started with cURL?

Visual Studio 2005 project files that get you started.

Problems that were resolved and how:

Mostly linker problems:

First linker problem you get

error LNK2019: unresolved external symbol __imp__curl_global_cleanup referenced in function _main
error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function _main
error LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function _main
error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function _main
error LNK2019: unresolved external symbol __imp__curl_easy_init referenced in function _main
error LNK2019: unresolved external symbol __imp__curl_global_init referenced in function _main

* Resolved by following yang’s grandmother’s 14 step process

SECOND linking problem you get (after resolving the first)

Linking...
curllib.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_unbind_s referenced in function _Curl_ldap
curllib.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_msgfree referenced in function _Curl_ldap 

* Resolved by linking in wldap32.lib by yang

some dude is wrting bout gaming here will read later
http://gamingrockson.blogspot.com/2008/06/sucking-at-older-games.html

also an interesting article on gaming ripoffs
http://www.retrojunk.com/details_articles/743/

Sometimes people want a way to use a kbhit() like function in C# at the Console.

while( true )
{
  if( Console.KeyAvailable ) // since .NET 2.0
  {
    char c = Console.ReadKey().KeyChar ;
    Console.Write( c );
  }
}

Itunes 64 bit is NOWHERE to be found on apple.com

Instead its here:
http://fileforum.betanews.com/detail/iTunes_for_Windows_x64/1066335784/3