Thread: connect() returns -1

  1. #1
    Politics&Cpp geek Da-Nuka's Avatar
    Join Date
    Oct 2004

    connect() returns -1

    Hmm...I get a errormessage saying connect() returns -1...
    (Yes, thorugh error-checking)

    What do this mean?
    -1 arent on the MSDN-list of possible errors

  2. #2
    Registered User
    Join Date
    Sep 2004
    MSDN says connect() returns SOCKET_ERROR if the function fails. SOCKET_ERROR is probably defined as -1. Call WSAGetLastError() to get the actual error code to get more information.

  3. #3
    Registered User
    Join Date
    Sep 2004
    You will find that the errors in all caps, are sometimes a defined error number like

    #define ERROR -2
    #define OTHERERROR -1
    If any part of my post is incorrect, please correct me.

    This post is not guarantied to be correct, and is not to be taken as a matter of fact, but of opinion or a guess, unless otherwise noted.

  4. #4
    I am me, who else?
    Join Date
    Oct 2002
    Yeah SOCKET_ERROR is defined as -1. So basically yeah you aren't connecting, use WSAGetLastError() to see whats up . Assuming you are using winsock of course.... oh I am repeating what bithub said... oh well.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Polynomials and ADT's
    By Emeighty in forum C++ Programming
    Replies: 20
    Last Post: 08-19-2008, 08:32 AM
  2. connect timeout
    By X PaYnE X in forum Networking/Device Communication
    Replies: 8
    Last Post: 05-14-2005, 09:30 PM
  3. Client timed-out once on connect(), can never connect() again
    By registering in forum Networking/Device Communication
    Replies: 6
    Last Post: 10-28-2003, 03:46 PM
  4. connect() returns "Network unreachable", but it isn't??
    By registering in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-22-2003, 02:09 PM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM