943,673 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 2177
  • C++ RSS
Jun 24th, 2007
0

WinSocket question

Expand Post »
Hello,

I have a server and client file.

In Client I have
C++ Syntax (Toggle Plain Text)
  1. WSADATA WsaData;
  2. SOCKET Socket;

In server I have
C++ Syntax (Toggle Plain Text)
  1. WSADATA xxx;
  2. SOCKET yyy;

This is same in both files:
C++ Syntax (Toggle Plain Text)
  1. sock_addr.sin_port = htons(1234);
Will this connection be established?
Similar Threads
Reputation Points: 27
Solved Threads: 2
Posting Whiz in Training
jan1024188 is offline Offline
254 posts
since Aug 2006
Jun 24th, 2007
0

Re: WinSocket question

No. here is one of many tutorials found with google.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,949 posts
since Aug 2005
Jun 24th, 2007
0

Re: WinSocket question

the server will bind to an address and start listening on it. the client socket is usually dynamically bound and tries to connect to the socket at the address the server has bound. so the port the client tries to connect to should be the same as the one the server used in the call to bind.
1234 is not an ideal choice for the port though. see http://en.wikipedia.org/wiki/List_of...P_port_numbers

will this connection be established? can't say. the port may already be in use (for 1234, this is likely in windows), the connection may be blocked/dropped by a firewall etc.
Reputation Points: 1159
Solved Threads: 285
Posting Virtuoso
vijayan121 is offline Offline
1,606 posts
since Dec 2006
Jun 25th, 2007
0

Re: WinSocket question

OK, thanks

It works now.
Reputation Points: 27
Solved Threads: 2
Posting Whiz in Training
jan1024188 is offline Offline
254 posts
since Aug 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: how to design board games in c++
Next Thread in C++ Forum Timeline: linking error





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC