From: Kevin Hock Date: Sun, 12 Feb 2006 00:44:54 +0000 (+0000) Subject: Document new SetLocal method, new capabilities for wxSOCKET_REUSEADDR, and new overlo... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2ccd904b011982314b5278044ce5febdee9d7369?ds=inline Document new SetLocal method, new capabilities for wxSOCKET_REUSEADDR, and new overloaded Connect method [ Documentation changes for extended patch 1415505 ] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/socket.tex b/docs/latex/wx/socket.tex index 6d91017973..fae16a9068 100644 --- a/docs/latex/wx/socket.tex +++ b/docs/latex/wx/socket.tex @@ -161,7 +161,8 @@ Functions that allow applications to customize socket IO as needed. \helpref{GetFlags}{wxsocketbasegetflags}\\ \helpref{SetFlags}{wxsocketbasesetflags}\\ -\helpref{SetTimeout}{wxsocketbasesettimeout} +\helpref{SetTimeout}{wxsocketbasesettimeout}\\ +\helpref{SetLocal}{wxsocketbasesetlocal}\\ \membersection{Handling socket events}\label{socketevents} @@ -560,8 +561,12 @@ The {\bf wxSOCKET\_REUSEADDR} flag controls the use of the SO\_REUSEADDR standar setsockopt() flag. This flag allows the socket to bind to a port that is already in use. This is mostly used on UNIX-based systems to allow rapid starting and stopping of a server - otherwise you may have to wait several minutes for the port to become available. -This option can have surprising platform dependent behavior, check the documentation for -your platform's implementation of setsockopt(). +wxSOCKET_REUSEADDR can also be used with socket clients to (re)bind to a particular local port +for an outgoing connection. +This option can have surprising platform dependent behavior, so check the documentation for +your platform's implementation of setsockopt(). Note that on BSD-based systems (e.g. Mac OS X), +use of wxSOCKET_REUSEADDR implies SO_REUSEPORT in addition to SO_REUSEADDR to be consistent +with Windows. So: @@ -576,7 +581,20 @@ the data. {\bf wxSOCKET\_BLOCK} has nothing to do with the previous flags and it controls whether the GUI blocks. -{\bf wxSOCKET\_REUSEADDR} controls special platform-specific behavior for wxServerSocket. +{\bf wxSOCKET\_REUSEADDR} controls special platform-specific behavior for +reusing local addresses/ports. + +% +% SetLocal +% +\membersection{wxSocketBase::SetLocal}\label{wxsocketbasesetlocal} + +\func{bool}{SetLocal}{\param{wxSockAddress\&}{ local}} + +This function allows you to set the local address and port, +useful when an application needs to reuse a particular port. When +a local port is set for a \helpref{wxSocketClient}{wxsocketclient}, +{\bf bind} will be called before {\bf connect}. % % SetNotify @@ -1018,6 +1036,9 @@ Destructor. Please see \helpref{wxSocketBase::Destroy}{wxsocketbasedestroy}. \func{bool}{Connect}{\param{wxSockAddress\&}{ address}, \param{bool}{ wait = true}} +\func{bool}{Connect}{\param{wxSockAddress\&}{ address}, \param{wxSockAddress\&}{ local}, +\param{bool}{ wait = true}} + Connects to a server using the specified address. If {\it wait} is true, Connect will wait until the connection @@ -1034,6 +1055,10 @@ and {\bf wxSOCKET\_LOST} events (for connection failure). \docparam{address}{Address of the server.} +\docparam{local}{Bind to the specified local address and port before connecting. +The local address and port can also be set using \helpref{SetLocal}{wxsocketbasesetlocal}, +and then using the 2-parameter Connect method.} + \docparam{wait}{If true, waits for the connection to complete.} \wxheading{Return value}