]> git.saurik.com Git - wxWidgets.git/blobdiff - docs/latex/wx/socket.tex
Updated to reflect some of the latest changes
[wxWidgets.git] / docs / latex / wx / socket.tex
index 263aeb58f5bcb543644023998b3011729714d521..a8a067dc0668f672635d077e01eaf7e5b675e48d 100644 (file)
@@ -105,7 +105,8 @@ handler macro to direct events to member functions that take a
 \membersection{Construction and destruction}
 
 \helpref{wxSocketBase}{wxsocketbaseconstruct}\\
-\helpref{\destruct{wxSocketBase}}{wxsocketbasedestruct}
+\helpref{\destruct{wxSocketBase}}{wxsocketbasedestruct}\\
+\helpref{wxDestroy}{wxsocketbasedestroy}
 
 \membersection{Socket state}
 
@@ -186,7 +187,9 @@ Default constructor. Don't use it directly; instead, use
 
 \func{}{\destruct{wxSocketBase}}{\void}
 
-Destructor.
+Destructor. Do not destroy a socket using the delete operator directly;
+use \helpref{Destroy}{wxsocketbasedestroy} instead. Also, do not create socket
+objects in the stack.
 
 %
 % Callback
@@ -252,8 +255,9 @@ A pointer to the previous user data.
 
 This function shuts down the socket, disabling further transmission and
 reception of data; it also disables events for the socket and frees the
-associated system resources. If you destroy a socket, Close is automatically
-called.
+associated system resources. Upon socket destruction, Close is automatically
+called. This means that you don't need to do it yourself, unless you
+explicitly want to disable further operation.
 
 \wxheading{Remark/Warning}
 
@@ -262,6 +266,26 @@ that event messages may be waiting in the application's event queue. The
 application must therefore be prepared to handle socket event messages
 even after calling Close.
 
+%
+% Destroy
+%
+\membersection{wxSocketBase::Destroy}\label{wxsocketbasedestroy}
+
+\func{bool}{Destroy}{\void}
+
+Destroys the socket safely. Use this function instead of the delete operator,
+since otherwise socket events could reach the application even after the
+socket has been destroyed. To prevent this problem, this function appends
+the wxSocket to a list of object to be deleted on idle time, after all
+events have been processed. For the same reason, you should avoid creating
+socket objects in the stack.
+
+Destroy calls \helpref{Close}{wxsocketbaseclose} automatically.
+
+\wxheading{Return value}
+
+Always TRUE.
+
 %
 % Discard
 %
@@ -401,6 +425,18 @@ will be sent.
 Returns TRUE if the socket is initialized and ready and FALSE in other
 cases.
 
+\wxheading{Remark/Warning}
+
+For \helpref{wxSocketClient}{wxsocketclient}, Ok won't return TRUE unless
+the client is connected to a server.
+
+For \helpref{wxSocketServer}{wxsocketserver}, Ok will return TRUE if the
+server could bind to the specified address and is already listening for
+new connections.
+
+Ok does not check for IO errors; use \helpref{Error}{wxsocketbaseerror}
+instead for that purpose.
+
 %
 % RestoreState
 %
@@ -474,7 +510,7 @@ See \helpref{Callback}{wxsocketbasecallback} and
 %
 \membersection{wxSocketBase::SetFlags}\label{wxsocketbasesetflags}
 
-\func{void}{SetFlags}{\param{wxSocketBase::wxSockFlags}{ flags}}
+\func{void}{SetFlags}{\param{wxSocketBase::wxSocketFlags}{ flags}}
 
 \twocolwidtha{7cm}
 \begin{twocollist}\itemsep=0pt
@@ -576,7 +612,7 @@ default is set to 10 minutes.
 %
 \membersection{wxSocketBase::Peek}\label{wxsocketbasepeek}
 
-\func{wxSocketBase\&}{Peek}{\param{char *}{ buffer}, \param{wxUint32}{ nbytes}}
+\func{wxSocketBase\&}{Peek}{\param{void *}{ buffer}, \param{wxUint32}{ nbytes}}
 
 This function peeks a buffer of {\it nbytes} bytes from the socket.
 Peeking a buffer doesn't delete it from the socket input queue.
@@ -612,7 +648,7 @@ of flags being used. For a detailed explanation, see \helpref{wxSocketBase::SetF
 %
 \membersection{wxSocketBase::Read}\label{wxsocketbaseread}
 
-\func{wxSocketBase\&}{Read}{\param{char *}{ buffer}, \param{wxUint32}{ nbytes}}
+\func{wxSocketBase\&}{Read}{\param{void *}{ buffer}, \param{wxUint32}{ nbytes}}
 
 This function reads a buffer of {\it nbytes} bytes from the socket.
 
@@ -647,7 +683,7 @@ of flags being used. For a detailed explanation, see \helpref{wxSocketBase::SetF
 %
 \membersection{wxSocketBase::ReadMsg}\label{wxsocketbasereadmsg}
 
-\func{wxSocketBase\&}{ReadMsg}{\param{char *}{ buffer}, \param{wxUint32}{ nbytes}}
+\func{wxSocketBase\&}{ReadMsg}{\param{void *}{ buffer}, \param{wxUint32}{ nbytes}}
 
 This function reads a buffer sent by \helpref{WriteMsg}{wxsocketbasewritemsg}
 on a socket. If the buffer passed to the function isn't big enough, the
@@ -688,7 +724,7 @@ For a detailed explanation, see \helpref{wxSocketBase::SetFlags}{wxsocketbaseset
 %
 \membersection{wxSocketBase::Unread}\label{wxsocketbaseunread}
 
-\func{wxSocketBase\&}{Unread}{\param{const char *}{ buffer}, \param{wxUint32}{ nbytes}}
+\func{wxSocketBase\&}{Unread}{\param{const void *}{ buffer}, \param{wxUint32}{ nbytes}}
 
 This function unreads a buffer. That is, the data in the buffer is put back
 in the incoming queue. This function is not affected by wxSocket flags.
@@ -846,7 +882,7 @@ Returns TRUE if the connection was lost, FALSE if the timeout was reached.
 %
 \membersection{wxSocketBase::Write}\label{wxsocketbasewrite}
 
-\func{wxSocketBase\&}{Write}{\param{const char *}{ buffer}, \param{wxUint32}{ nbytes}}
+\func{wxSocketBase\&}{Write}{\param{const void *}{ buffer}, \param{wxUint32}{ nbytes}}
 
 This function writes a buffer of {\it nbytes} bytes to the socket.
 
@@ -881,7 +917,7 @@ of flags being used. For a detailed explanation, see \helpref{wxSocketBase::SetF
 %
 \membersection{wxSocketBase::WriteMsg}\label{wxsocketbasewritemsg}
 
-\func{wxSocketBase\&}{WriteMsg}{\param{const char *}{ buffer}, \param{wxUint32}{ nbytes}}
+\func{wxSocketBase\&}{WriteMsg}{\param{const void *}{ buffer}, \param{wxUint32}{ nbytes}}
 
 This function writes a buffer of {\it nbytes} bytes from the socket, but it
 writes a short header before so that \helpref{ReadMsg}{wxsocketbasereadmsg}
@@ -941,7 +977,7 @@ For a detailed explanation, see \helpref{wxSocketBase::SetFlags}{wxsocketbaseset
 %
 \membersection{wxSocketClient::wxSocketClient}
 
-\func{}{wxSocketClient}{\param{wxSockFlags}{ flags = wxSocketBase::NONE}}
+\func{}{wxSocketClient}{\param{wxSocketFlags}{ flags = wxSOCKET_NONE}}
 
 Constructor.
 
@@ -1090,16 +1126,16 @@ functions that take a wxSocketEvent argument.
 
 Constructor.
 
-\membersection{wxSocketEvent::Socket}\label{wxsocketeventsocket}
+\membersection{wxSocketEvent::GetSocket}\label{wxsocketeventgetsocket}
 
-\constfunc{wxSocketBase *}{Socket}{\void}
+\constfunc{wxSocketBase *}{GetSocket}{\void}
 
 Returns the socket object to which this event refers to. This makes
 it possible to use the same event handler for different sockets.
 
-\membersection{wxSocketEvent::SocketEvent}\label{wxsocketeventsocketevent}
+\membersection{wxSocketEvent::GetSocketEvent}\label{wxsocketeventgetsocketevent}
 
-\constfunc{wxSocketNotify}{SocketEvent}{\void}
+\constfunc{wxSocketNotify}{GetSocketEvent}{\void}
 
 Returns the socket event type.
 
@@ -1126,7 +1162,7 @@ Returns the socket event type.
 %
 \membersection{wxSocketServer::wxSocketServer}\label{wxsocketserverconstr}
 
-\func{}{wxSocketServer}{\param{wxSockAddress\&}{ address}, \param{wxSockFlags}{ flags = wxSocketBase::NONE}}
+\func{}{wxSocketServer}{\param{wxSockAddress\&}{ address}, \param{wxSocketFlags}{ flags = wxSOCKET_NONE}}
 
 Constructs a new server and tries to bind to the specified {\it address}.
 Before trying to accept new connections, test whether it succeeded with