Thread: Error on Async socket startup!

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question Error on Async socket startup!

    I will post my code. When I use WSAGetLastError(); it connect() fails, I have a MessageBox(...) with the error and it comes up and Async sockets won't start. I will attach my code!
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    2 things.....

    [list=1][*]itoa()'s third param is not the amount of chars in the buffer...it is the base....therefore for decimal use 10 instead of 100[*]The error returned is 10035. This I believe is because you are selecting a nonblocking socket and then trying to call select on it.....[/list=1]

  3. #3
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question How would I...

    What do I have to do to create a blocking socket so I can Async?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    To tell you the truth I havent done this stuff in ages......but I guess the program should just listen after selecting up the socket.....

    Have a search on google for more help, or wait for someone who remembers more about it than me...

    :: damn I gotta read my winsock book again! ::

  5. #5
    Registered User johnnie2's Avatar
    Join Date
    Aug 2001
    Posts
    186
    > What do I have to do to create a blocking socket so I can Async?

    This is almost like saying freezer burn or jumbo shrimp...it just doesn't work . Blocking and asynchronous sockets are two very different things; blocking sockets will not return during a function call until something happens, while asynchronous sockets are more like the Windows message system we've all grown to love and post notifications.

    You might want to visit http://www.hal-pc.org/~johnnie2/winsock.html and gamedev's async article. Beware of the latter tutorial...FD_READ is not nearly as easy as what it seems.

    Regarding your questions in the previous post, you do not necessarily have to handle FD_CONNECT and FD_ACCEPT messages at all. In fact, FD_CONNECT is used almost exclusively in clients while servers interpret FD_ACCEPT. Like any other standard Winproc message, you can handle only what you want and disregard the rest.

    I agree with Fordy on error 10035.
    "Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. socket programming question, closing sockets...
    By ursula in forum Networking/Device Communication
    Replies: 2
    Last Post: 05-31-2009, 05:17 PM
  2. async Client/Server app, accept() stalls?
    By JaWiB in forum Networking/Device Communication
    Replies: 14
    Last Post: 01-31-2005, 05:59 PM
  3. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 11:48 AM
  4. async socket issues
    By ZerOrDie in forum Windows Programming
    Replies: 2
    Last Post: 03-16-2003, 06:10 PM
  5. Async Socket Examples?
    By SyntaxBubble in forum Windows Programming
    Replies: 1
    Last Post: 01-04-2002, 06:08 PM