Thread: What's wrong with this code?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User Finchie_88's Avatar
    Join Date
    Aug 2004
    Posts
    154

    Question What's wrong with this code?

    I can't understand what I'm doing wrong, here is the server code and part of the client code.
    Server:
    Code:
    SOCKET TempSocket = SOCKET_ERROR; // Set the TempSocket to error //
        
        while(TempSocket = SOCKET_ERROR)
        {
              TempSocket = accept(Socket, NULL, NULL);
        }
        Socket = TempSocket;
    Client:
    Code:
    if(connect(Socket, (SOCKADDR*)(&SockAddr), sizeof(SockAddr)) != 0)
        {
                  SetConsoleTextAttribute(houtput, BACKGROUND_RED|BACKGROUND_INTENSITY);
                  status = GetLastError();
                  cout << "" << endl;
                  cout << "Failed to establish connection with the server" << endl;
                  cout << "Application error code: " << status << endl;
                  hinput = NULL;
                  houtput = NULL;
                  herror = NULL;
                  Sleep(10000);
                  return;
        }
    Last edited by Finchie_88; 05-24-2005 at 01:10 PM.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what is wrong in this simple code
    By vikingcarioca in forum C Programming
    Replies: 4
    Last Post: 04-23-2009, 07:10 AM
  2. what is wrong with this code please
    By korbitz in forum Windows Programming
    Replies: 3
    Last Post: 03-05-2004, 10:11 AM
  3. I cant find what is wrong with this code
    By senegene in forum C Programming
    Replies: 1
    Last Post: 11-12-2002, 06:32 PM
  4. Anyone see what is wrong with this code?
    By Wise1 in forum C Programming
    Replies: 2
    Last Post: 02-13-2002, 02:01 PM
  5. very simple code, please check to see whats wrong
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 10-10-2001, 12:51 AM