Results 1 to 2 of 2

Thread: Windows Sockets

  1. #1
    Join Date
    Sep 2002

    Windows Sockets


    Recently I've been wondering how CSocket (in MFC) can make a connection to a client app. (on the same port). Obviously both the server app. and the client app. need to be on the same port, but every time I try to "create" the socket, I get an error. I make the call to afxSocketInit(), to enable the socket. The tricky part is the error that I recieve doesn't match with any of the HELP ID's. So in other words, an error is put forth by the create function but the error cannot be matched with any of the default error ID's. So any enlightenment at all would be great. This is really pissing me off honestly.


  2. #2
    Senior Member
    Join Date
    Jan 2002
    I haven't used MFC's CSocket but seeing as it's just a wrapper the same should apply - this is a guess as to what's wrong.

    The client socket does not need to be and should not be bound to the server port. When binding the client socket, tell it to automatically choose a port (Not sure how this works with CSocket).

    If you bind the client socket to a given port, you will prevent the server and client running on the same machine, and prevent two instances of the client running on the same machine.

    Some very lame programs do this, and it sucks. Just don't do it

    The client needs to connect to the server's port, not bind to it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts