Various small fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@6895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guillermo Rodriguez Garcia
2000-03-21 21:02:43 +00:00
parent ad269e4c7c
commit fb5e087649
2 changed files with 67 additions and 58 deletions

View File

@@ -44,7 +44,7 @@ defines all basic IO functionality.
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxSOCKET\_INPUT}}{There is data available for reading.} \twocolitem{{\bf wxSOCKET\_INPUT}}{There is data available for reading.}
\twocolitem{{\bf wxSOCKET\_OUTPUT}}{The socket is ready to be written to.} \twocolitem{{\bf wxSOCKET\_OUTPUT}}{The socket is ready to be written to.}
\twocolitem{{\bf wxSOCKET\_CONNECTION}}{Incoming connection (server), or connection establishment (client).} \twocolitem{{\bf wxSOCKET\_CONNECTION}}{Incoming connection request (server), or successful connection establishment (client).}
\twocolitem{{\bf wxSOCKET\_LOST}}{The connection has been closed.} \twocolitem{{\bf wxSOCKET\_LOST}}{The connection has been closed.}
\end{twocollist} \end{twocollist}
@@ -76,13 +76,13 @@ at the incoming queue (server).
The {\bf wxSOCKET\_LOST} event is issued when a close indication is The {\bf wxSOCKET\_LOST} event is issued when a close indication is
received for the socket. This means that the connection broke down or received for the socket. This means that the connection broke down or
that it was closed by the peer. Also, this event will be issued if that it was closed by the peer. Also, this event will be issued if
a delayed connection request fails. a connection request fails.
\wxheading{Event handling} \wxheading{Event handling}
To process events coming from a socket object, use the following event To process events coming from a socket object, use the following event
handler macro to direct events to member functions that take a handler macro to direct events to member functions that take
\helpref{wxSocketEvent}{wxsocketevent} argument. a \helpref{wxSocketEvent}{wxsocketevent} argument.
\twocolwidtha{7cm}% \twocolwidtha{7cm}%
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
@@ -106,7 +106,7 @@ handler macro to direct events to member functions that take a
\helpref{wxSocketBase}{wxsocketbaseconstruct}\\ \helpref{wxSocketBase}{wxsocketbaseconstruct}\\
\helpref{\destruct{wxSocketBase}}{wxsocketbasedestruct}\\ \helpref{\destruct{wxSocketBase}}{wxsocketbasedestruct}\\
\helpref{wxDestroy}{wxsocketbasedestroy} \helpref{Destroy}{wxsocketbasedestroy}
\membersection{Socket state} \membersection{Socket state}
@@ -223,12 +223,15 @@ event occurred. The second parameter tells you which event occurred.
(See \helpref{wxSocket events}{wxsocketbase}). The third parameter (See \helpref{wxSocket events}{wxsocketbase}). The third parameter
is the user data you specified using \helpref{CallbackData}{wxsocketbasecallbackdata}. is the user data you specified using \helpref{CallbackData}{wxsocketbasecallbackdata}.
Note that events are preferred over callbacks where possible.
\wxheading{Return value} \wxheading{Return value}
A pointer to the previous callback. A pointer to the previous callback.
\wxheading{Remark/Warning}
Note that callbacks are now deprecated and unsupported, and they remain
for backwards compatibility only. Use events instead.
\wxheading{See also} \wxheading{See also}
\helpref{wxSocketBase::CallbackData}{wxsocketbasecallbackdata}, \helpref{wxSocketBase::CallbackData}{wxsocketbasecallbackdata},
@@ -245,12 +248,17 @@ A pointer to the previous callback.
This function sets the the user data which will be passed to a This function sets the the user data which will be passed to a
callback function set via \helpref{Callback}{wxsocketbasecallback}. callback function set via \helpref{Callback}{wxsocketbasecallback}.
Note that events are preferred over callbacks where possible.
\wxheading{Return value} \wxheading{Return value}
A pointer to the previous user data. A pointer to the previous user data.
\wxheading{Remark/Warning}
Note that callbacks are now deprecated and unsupported, and they remain
for backwards compatibility only. Use events instead.
\wxheading{See also}
\helpref{wxSocketBase::Callback}{wxsocketbasecallback}, \helpref{wxSocketBase::Callback}{wxsocketbasecallback},
\helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify}, \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify},
\helpref{wxSocketBase::Notify}{wxsocketbasenotify} \helpref{wxSocketBase::Notify}{wxsocketbasenotify}
@@ -265,8 +273,9 @@ A pointer to the previous user data.
This function shuts down the socket, disabling further transmission and This function shuts down the socket, disabling further transmission and
reception of data; it also disables events for the socket and frees the reception of data; it also disables events for the socket and frees the
associated system resources. Upon socket destruction, Close is automatically associated system resources. Upon socket destruction, Close is automatically
called. This means that you don't need to do it yourself, unless you called, so in most cases you won't need to do it yourself, unless you
explicitly want to disable further operation. explicitly want to shut down the socket, typically to notify the peer
that you are closing the connection.
\wxheading{Remark/Warning} \wxheading{Remark/Warning}
@@ -336,7 +345,7 @@ Returns a pointer of the client data for this socket, as set with
% %
\membersection{wxSocketBase::GetLocal}\label{wxsocketbasegetlocal} \membersection{wxSocketBase::GetLocal}\label{wxsocketbasegetlocal}
\constfunc{bool}{GetLocal}{\param{wxSockAddress\& }{addr\_man}} \constfunc{bool}{GetLocal}{\param{wxSockAddress\& }{addr}}
This function returns the local address field of the socket. The local This function returns the local address field of the socket. The local
address field contains the complete local address of the socket (local address field contains the complete local address of the socket (local
@@ -344,7 +353,7 @@ address, local port, ...).
\wxheading{Return value} \wxheading{Return value}
It returns TRUE if no errors happened, FALSE otherwise. TRUE if no error happened, FALSE otherwise.
% %
% GetFlags % GetFlags
@@ -360,7 +369,7 @@ Returns current IO flags, as set with \helpref{SetFlags}{wxsocketbasesetflags}
% %
\membersection{wxSocketBase::GetPeer}\label{wxsocketbasegetpeer} \membersection{wxSocketBase::GetPeer}\label{wxsocketbasegetpeer}
\constfunc{bool}{GetPeer}{\param{wxSockAddress\& }{addr\_man}} \constfunc{bool}{GetPeer}{\param{wxSockAddress\& }{addr}}
This function returns the peer address field of the socket. The peer This function returns the peer address field of the socket. The peer
address field contains the complete peer host address of the socket address field contains the complete peer host address of the socket
@@ -368,7 +377,7 @@ address field contains the complete peer host address of the socket
\wxheading{Return value} \wxheading{Return value}
It returns TRUE if no errors happened, FALSE otherwise. TRUE if no error happened, FALSE otherwise.
% %
% InterruptWait % InterruptWait
@@ -484,8 +493,8 @@ For \helpref{wxSocketServer}{wxsocketserver}, Ok will return TRUE if the
server could bind to the specified address and is already listening for server could bind to the specified address and is already listening for
new connections. new connections.
Ok does not check for IO errors; use \helpref{Error}{wxsocketbaseerror} Ok does not check for IO errors;
instead for that purpose. use \helpref{Error}{wxsocketbaseerror} instead for that purpose.
% %
% RestoreState % RestoreState
@@ -532,16 +541,15 @@ Calls to SaveState and RestoreState can be nested.
\func{void}{SetClientData}{\param{void *}{data}} \func{void}{SetClientData}{\param{void *}{data}}
Sets user-supplied client data for this socket. All socket events will Sets user-supplied client data for this socket. All socket events will
contain a pointer to this data, which can be retrieved with the contain a pointer to this data, which can be retrieved with
\helpref{wxSocketEvent::GetClientData}{wxsocketeventgetclientdata} the \helpref{wxSocketEvent::GetClientData}{wxsocketeventgetclientdata} function.
function.
% %
% SetEventHandler % SetEventHandler
% %
\membersection{wxSocketBase::SetEventHandler}\label{wxsocketbaseseteventhandler} \membersection{wxSocketBase::SetEventHandler}\label{wxsocketbaseseteventhandler}
\func{void}{SetEventHandler}{\param{wxEvtHandler\&}{ evt\_hdlr}, \param{int}{ id = -1}} \func{void}{SetEventHandler}{\param{wxEvtHandler\&}{ handler}, \param{int}{ id = -1}}
Sets an event handler to be called when a socket event occurs. The Sets an event handler to be called when a socket event occurs. The
handler will be called for those events for which notification is handler will be called for those events for which notification is
@@ -550,7 +558,7 @@ enabled with \helpref{SetNotify}{wxsocketbasesetnotify} and
\wxheading{Parameters} \wxheading{Parameters}
\docparam{evt\_hdlr}{Specifies the event handler you want to use.} \docparam{handler}{Specifies the event handler you want to use.}
\docparam{id}{The id of socket event.} \docparam{id}{The id of socket event.}
@@ -566,11 +574,11 @@ enabled with \helpref{SetNotify}{wxsocketbasesetnotify} and
% %
\membersection{wxSocketBase::SetFlags}\label{wxsocketbasesetflags} \membersection{wxSocketBase::SetFlags}\label{wxsocketbasesetflags}
\func{void}{SetFlags}{\param{wxSocketBase::wxSocketFlags}{ flags}} \func{void}{SetFlags}{\param{wxSocketFlags}{ flags}}
Use SetFlags to customize IO operation for this socket. The {\it flags} Use SetFlags to customize IO operation for this socket.
parameter is a combination of flags ORed toghether. The following flags The {\it flags} parameter may be a combination of flags ORed toghether.
can be used: The following flags can be used:
\twocolwidtha{7cm} \twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
@@ -585,9 +593,9 @@ A brief overview on how to use these flags follows.
If no flag is specified (this is the same as {\bf wxSOCKET\_NONE}), If no flag is specified (this is the same as {\bf wxSOCKET\_NONE}),
IO calls will return after some data has been read or written, even IO calls will return after some data has been read or written, even
when the transfer might not be complete. This is the same as issuing when the transfer might not be complete. This is the same as issuing
exactly one blocking low-level call to recv() or send(). Note that exactly one blocking low-level call to recv() or send(). Note
{\it blocking} here refers to when the function returns, not to whether that {\it blocking} here refers to when the function returns, not
the GUI blocks during this time. to whether the GUI blocks during this time.
If {\bf wxSOCKET\_NOWAIT} is specified, IO calls will return immediately. If {\bf wxSOCKET\_NOWAIT} is specified, IO calls will return immediately.
Read operations will retrieve only available data. Write operations will Read operations will retrieve only available data. Write operations will
@@ -601,9 +609,9 @@ If {\bf wxSOCKET\_WAITALL} is specified, IO calls won't return until ALL
the data has been read or written (or until an error occurs), blocking if the data has been read or written (or until an error occurs), blocking if
necessary, and issuing several low level calls if necessary. This is the necessary, and issuing several low level calls if necessary. This is the
same as having a loop which makes as many blocking low-level calls to same as having a loop which makes as many blocking low-level calls to
recv() or send() as needed so as to transfer all the data. Note that recv() or send() as needed so as to transfer all the data. Note
{\it blocking} here refers to when the function returns, not to whether that {\it blocking} here refers to when the function returns, not
the GUI blocks during this time. to whether the GUI blocks during this time.
The {\bf wxSOCKET\_BLOCK} flag controls whether the GUI blocks during The {\bf wxSOCKET\_BLOCK} flag controls whether the GUI blocks during
IO operations. If this flag is specified, the socket will not yield IO operations. If this flag is specified, the socket will not yield
@@ -632,7 +640,7 @@ it controls whether the GUI blocks.
\func{void}{SetNotify}{\param{wxSocketEventFlags}{ flags}} \func{void}{SetNotify}{\param{wxSocketEventFlags}{ flags}}
SetNotify specifies which socket events are to be sent to the event handler. SetNotify specifies which socket events are to be sent to the event handler.
The {\it flags} parameter is a combination of flags ORed toghether. The The {\it flags} parameter may be combination of flags ORed toghether. The
following flags can be used: following flags can be used:
\twocolwidtha{7cm} \twocolwidtha{7cm}
@@ -663,9 +671,9 @@ For more information on socket events see \helpref{wxSocket events}{wxsocketbase
\func{void}{SetTimeout}{\param{int }{seconds}} \func{void}{SetTimeout}{\param{int }{seconds}}
This function sets the default socket timeout in seconds. This timeout This function sets the default socket timeout in seconds. This timeout
applies to all IO calls, and also to the \helpref{Wait}{wxsocketbasewait} applies to all IO calls, and also to the \helpref{Wait}{wxsocketbasewait} family
family of functions if you don't specify a wait interval. Initially, the of functions if you don't specify a wait interval. Initially, the default
default is set to 10 minutes. timeout is 10 minutes.
% %
% Peek % Peek
@@ -816,18 +824,19 @@ Returns a reference to the current object.
\func{bool}{Wait}{\param{long}{ seconds = -1}, \param{long}{ millisecond = 0}} \func{bool}{Wait}{\param{long}{ seconds = -1}, \param{long}{ millisecond = 0}}
This function waits until one of the following conditions is TRUE. Note This function waits until any of the following conditions is TRUE:
that it is recommended to use the individual Wait functions to wait for
the required condition, instead of this one.
\begin{itemize} \begin{itemize}
\item The socket becomes readable. \item The socket becomes readable.
\item The socket becomes writable. \item The socket becomes writable.
\item An ongoing connection request has completed (only for clients) \item An ongoing connection request has completed (\helpref{wxSocketClient}{wxsocketclient} only)
\item An incoming connection request has arrived (only for servers) \item An incoming connection request has arrived (\helpref{wxSocketServer}{wxsocketserver} only)
\item The connection has been closed. \item The connection has been closed.
\end{itemize} \end{itemize}
Note that it is recommended to use the individual Wait functions
to wait for the required condition, instead of this one.
\wxheading{Parameters} \wxheading{Parameters}
\docparam{seconds}{Number of seconds to wait. \docparam{seconds}{Number of seconds to wait.
@@ -1054,7 +1063,7 @@ Constructor.
\func{}{\destruct{wxSocketClient}}{\void} \func{}{\destruct{wxSocketClient}}{\void}
Destructor. Destructor. Please see \helpref{wxSocketBase::Destroy}{wxsocketbasedestroy}.
% %
% Connect % Connect
@@ -1065,8 +1074,8 @@ Destructor.
Connects to a server using the specified address. Connects to a server using the specified address.
If {\it wait} is TRUE, Connect will wait until the connection completes. If {\it wait} is TRUE, Connect will wait until the connection
{\bf Warning:} This will block the GUI. completes. {\bf Warning:} This will block the GUI.
If {\it wait} is FALSE, Connect will try to establish the connection and If {\it wait} is FALSE, Connect will try to establish the connection and
return immediately, without blocking the GUI. When used this way, even if return immediately, without blocking the GUI. When used this way, even if
@@ -1090,8 +1099,8 @@ and the connection failed.
If {\it wait} was FALSE, and Connect returns FALSE, you should still If {\it wait} was FALSE, and Connect returns FALSE, you should still
be prepared to handle the completion of this connection request, either be prepared to handle the completion of this connection request, either
with \helpref{WaitOnConnect}{wxsocketclientwaitonconnect} or by watching with \helpref{WaitOnConnect}{wxsocketclientwaitonconnect} or by
{\bf wxSOCKET\_CONNECTION} and {\bf wxSOCKET\_LOST} events. watching {\bf wxSOCKET\_CONNECTION} and {\bf wxSOCKET\_LOST} events.
\wxheading{See also} \wxheading{See also}
@@ -1107,8 +1116,8 @@ with \helpref{WaitOnConnect}{wxsocketclientwaitonconnect} or by watching
\func{bool}{WaitOnConnect}{\param{long}{ seconds = -1}, \param{long}{ milliseconds = 0}} \func{bool}{WaitOnConnect}{\param{long}{ seconds = -1}, \param{long}{ milliseconds = 0}}
Wait until a connection request completes, or until the specified timeout Wait until a connection request completes, or until the specified timeout
elapses. Use this function after issuing a call to \helpref{Connect}{wxsocketclientconnect} elapses. Use this function after issuing a call
with {\it wait} set to FALSE. to \helpref{Connect}{wxsocketclientconnect} with {\it wait} set to FALSE.
\wxheading{Parameters} \wxheading{Parameters}
@@ -1139,7 +1148,7 @@ bool waitmore = TRUE;
while ( !client->WaitOnConnect(seconds, millis) && waitmore ) while ( !client->WaitOnConnect(seconds, millis) && waitmore )
{ {
// possibly give some feedback to the user, // possibly give some feedback to the user,
// and update waitmore if needed. // and update waitmore as needed.
} }
bool success = client->IsConnected(); bool success = client->IsConnected();
\end{verbatim} \end{verbatim}
@@ -1167,8 +1176,8 @@ This event class contains information about socket events.
\wxheading{Event table macros} \wxheading{Event table macros}
To process a socket event, use these event handler macros to direct input to member To process a socket event, use these event handler macros to direct input
functions that take a wxSocketEvent argument. to member functions that take a wxSocketEvent argument.
\twocolwidtha{7cm} \twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
@@ -1265,8 +1274,8 @@ Accepts an incoming connection request, and creates a new
the server-side of the connection. the server-side of the connection.
If {\it wait} is TRUE and there are no pending connections to be If {\it wait} is TRUE and there are no pending connections to be
accepted, it will wait for the next incoming connection to arrive. accepted, it will wait for the next incoming connection to
{\bf Warning:} This will block the GUI. arrive. {\bf Warning:} This will block the GUI.
If {\it wait} is FALSE, it will try to accept a pending connection If {\it wait} is FALSE, it will try to accept a pending connection
if there is one, but it will always return immediately without blocking if there is one, but it will always return immediately without blocking
@@ -1310,7 +1319,7 @@ connections.
\helpref{wxSocketServer::WaitForAccept}{wxsocketserverwaitforaccept}, \helpref{wxSocketServer::WaitForAccept}{wxsocketserverwaitforaccept},
\helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify}, \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify},
\helpref{wxSocketBase::Notify}{wxsocketbasenotify}, \helpref{wxSocketBase::Notify}{wxsocketbasenotify},
\helpref{wxSocketServer::Accept}{wxsocketserveraccept} for a detailed explanation \helpref{wxSocketServer::Accept}{wxsocketserveraccept}
% %
% WaitForAccept % WaitForAccept

View File

@@ -301,8 +301,8 @@ they set up their own event handler, and then request to be notified
of {\bf wxSOCKET\_INPUT} (incoming data) or {\bf wxSOCKET\_LOST} of {\bf wxSOCKET\_INPUT} (incoming data) or {\bf wxSOCKET\_LOST}
(connection closed at the remote end) events. In the sample, the event (connection closed at the remote end) events. In the sample, the event
handler is the same for all connections; to find out which socket the handler is the same for all connections; to find out which socket the
event is addressed to, the \helpref{GetSocket}{wxsocketeventgetsocket} event is addressed to, the \helpref{GetSocket}{wxsocketeventgetsocket} function
function is used. is used.
Although it might take some time to get used to the event-oriented Although it might take some time to get used to the event-oriented
system upon which wxSocket is built, the benefits are many. See, for system upon which wxSocket is built, the benefits are many. See, for
@@ -323,8 +323,8 @@ both clients and connection objects in the server set up an event handler
to catch {\bf wxSOCKET\_LOST} events, each one is immediately notified to catch {\bf wxSOCKET\_LOST} events, each one is immediately notified
if the other end closes the connection. if the other end closes the connection.
There is also an URL test which shows how to use the \helpref{wxURL}{wxurl} There is also an URL test which shows how to use
class to fetch data from a given URL. the \helpref{wxURL}{wxurl} class to fetch data from a given URL.
The sockets sample is work in progress. Some things to do: The sockets sample is work in progress. Some things to do: