ChatProgram not working

This is a discussion on ChatProgram not working within the Networking/Device Communication forums, part of the General Programming Boards category; Hi. I have made a chat program, and error-handeld every single part of the network-code..(I think). When i try to ...

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

    ChatProgram not working

    Hi. I have made a chat program, and error-handeld every single part of the network-code..(I think).
    When i try to test the program on my network, the client connecting the listening-chatprogram, think it is connected,
    and the listening chatprogram dont seem to react to the connection...

    (yeah, i have tried to turn off the firewall).
    I am using Dev-C++, programming for windows.

    I have included the source-code so far...
    Can anyone see whats wrong?
    Attached Files Attached Files

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    The first thing you might try is setting the socket that you accept with WSAAsyncSelect:
    Code:
    clientSocket = accept(listeningSocket, NULL, NULL);
     if (WSAAsyncSelect(clientSocket, hwnd, WM_WSAASYNC,  FD_CONNECT | FD_WRITE |
                                            FD_READ | FD_CLOSE)!=0) //set up asynchronous sockets
                                //request WRITE, READ, CONNECT, and CLOSE messages be sent
      {
        //error
      }
    I had a problem like this and that solved it for me. Of course, I'm no expert at network programming, but it's worth a try.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function not working
    By sloopy in forum C Programming
    Replies: 31
    Last Post: 11-12-2005, 07:08 PM
  2. Program Not working Right
    By raven420smoke in forum C++ Programming
    Replies: 2
    Last Post: 09-16-2005, 03:21 AM
  3. Trying to eject D drive using code, but not working... :(
    By snowfrog in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 07:47 PM
  4. x on upper right corner not working
    By caduardo21 in forum Windows Programming
    Replies: 1
    Last Post: 02-20-2005, 07:35 PM
  5. cygwin -> unix , my code not working properly ;(
    By CyC|OpS in forum C Programming
    Replies: 4
    Last Post: 05-18-2002, 04:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21