0

Hello,

I have a server and client file.

In Client I have

WSADATA WsaData;
SOCKET Socket;

In server I have

WSADATA xxx;
SOCKET yyy;

This is same in both files:

sock_addr.sin_port = htons(1234);

Will this connection be established?

3
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by jan1024188
0

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_TCP_and_UDP_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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.