Server How to get or set server name (number) when using wxTCPConnection and wxTCPServer

5 views
Skip to first unread message

Daniel

unread,
Nov 23, 2009, 6:42:00 PM11/23/09
to wx-users
How can wxTCPConnection running on a client know what server name to
use when making a connection? Or is it possible to start the server
(wxTCPServer) with a particular server name (number) ?

Kenneth Porter

unread,
Nov 23, 2009, 7:38:20 PM11/23/09
to wx-u...@googlegroups.com
On Monday, November 23, 2009 3:42 PM -0800 Daniel <danw...@gmail.com>
wrote:

> How can wxTCPConnection running on a client know what server name to
> use when making a connection? Or is it possible to start the server
> (wxTCPServer) with a particular server name (number) ?

The name in this case is that of a TCP service. These are listed in
/etc/services. You can also pass a string containing a decimal port number.
The name is looked up in /etc/services and the resulting TCP port number is
what will be connected to.

Your client and server should agree on what port number to use. If you
don't use a standard protocol, then allow the user to configure this and
suggest a reasonable default. Unprivileged programs should use a number
above 1024.

<http://en.wikipedia.org/wiki/TCP_and_UDP_port>

<http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers>


Daniel

unread,
Nov 24, 2009, 11:19:16 AM11/24/09
to wx-users
In the server program what function do I use to set the server name/
port number?

Kenneth Porter

unread,
Nov 24, 2009, 11:38:54 AM11/24/09
to wx-u...@googlegroups.com
--On Tuesday, November 24, 2009 8:19 AM -0800 Daniel <danw...@gmail.com>
wrote:

> In the server program what function do I use to set the server name/
> port number?

wxTCPServer::Create

<http://docs.wxwidgets.org/trunk/classwx_t_c_p_server.html>


Reply all
Reply to author
Forward
0 new messages