more doc fixes, to wording and to return types ('&'s have been lost)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57667 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-30 14:49:24 +00:00
parent ee533e88db
commit 9940bebff4

View File

@@ -154,7 +154,7 @@ public:
bool AcceptWith(wxSocketBase& socket, bool wait = true); bool AcceptWith(wxSocketBase& socket, bool wait = true);
/** /**
This function waits for an incoming connection. Wait for an incoming connection.
Use it if you want to call Accept() or AcceptWith() with @e wait set Use it if you want to call Accept() or AcceptWith() with @e wait set
to @false, to detect when an incoming connection is waiting to be accepted. to @false, to detect when an incoming connection is waiting to be accepted.
@@ -720,18 +720,14 @@ public:
bool Error() const; bool Error() const;
/** /**
This function returns the local address field of the socket. The local Return the local address of the socket.
address field contains the complete local address of the socket (local
address, local port, ...).
@return @true if no error happened, @false otherwise. @return @true if no error happened, @false otherwise.
*/ */
bool GetLocal(wxSockAddress& addr) const; bool GetLocal(wxSockAddress& addr) const;
/** /**
This function returns the peer address field of the socket. The peer Return the peer address field of the socket.
address field contains the complete peer host address of the socket
(address, port, ...).
@return @true if no error happened, @false otherwise. @return @true if no error happened, @false otherwise.
*/ */
@@ -750,7 +746,7 @@ public:
bool IsConnected() const; bool IsConnected() const;
/** /**
This function waits until the socket is readable. Check if the socket can be currently read or written.
This might mean that queued data is available for reading or, for streamed This might mean that queued data is available for reading or, for streamed
sockets, that the connection has been closed, so that a read operation will sockets, that the connection has been closed, so that a read operation will
@@ -798,8 +794,7 @@ public:
wxSocketError LastError() const; wxSocketError LastError() const;
/** /**
This function restores the previous state of the socket, as saved Restore the previous state of the socket, as saved with SaveState().
with SaveState().
Calls to SaveState() and RestoreState() can be nested. Calls to SaveState() and RestoreState() can be nested.
@@ -808,7 +803,8 @@ public:
void RestoreState(); void RestoreState();
/** /**
This function saves the current state of the socket in a stack. Save the current state of the socket in a stack.
Socket state includes flags, as set with SetFlags(), event mask, as set Socket state includes flags, as set with SetFlags(), event mask, as set
with SetNotify() and Notify(), user data, as set with SetClientData(). with SetNotify() and Notify(), user data, as set with SetClientData().
Calls to SaveState and RestoreState can be nested. Calls to SaveState and RestoreState can be nested.
@@ -828,9 +824,9 @@ public:
//@{ //@{
/** /**
This function shuts down the socket, disabling further transmission and Shut down the socket, disabling further transmission and reception of
reception of data; it also disables events for the socket and frees the data and disable events for the socket and frees the associated system
associated system resources. resources.
Upon socket destruction, Close() is automatically called, so in most cases Upon socket destruction, Close() is automatically called, so in most cases
you won't need to do it yourself, unless you explicitly want to shut down you won't need to do it yourself, unless you explicitly want to shut down
@@ -854,14 +850,16 @@ public:
void ShutdownOutput(); void ShutdownOutput();
/** /**
This function simply deletes all bytes in the incoming queue. This function Delete all bytes in the incoming queue.
always returns immediately and its operation is not affected by IO flags.
This function always returns immediately and its operation is not
affected by IO flags.
Use LastCount() to verify the number of bytes actually discarded. Use LastCount() to verify the number of bytes actually discarded.
If you use Error(), it will always return @false. If you use Error(), it will always return @false.
*/ */
wxSocketBase Discard(); wxSocketBase& Discard();
/** /**
Returns current IO flags, as set with SetFlags() Returns current IO flags, as set with SetFlags()
@@ -884,9 +882,11 @@ public:
void InterruptWait(); void InterruptWait();
/** /**
This function peeks a buffer of @a nbytes bytes from the socket. Peek into the socket by copying the next bytes which would be read by
Read() into the provided buffer.
Peeking a buffer doesn't delete it from the socket input queue. Peeking a buffer doesn't delete it from the socket input queue, i.e.
calling Read() will return the same data.
Use LastCount() to verify the number of bytes actually peeked. Use LastCount() to verify the number of bytes actually peeked.
@@ -905,10 +905,11 @@ public:
@see Error(), LastError(), LastCount(), SetFlags() @see Error(), LastError(), LastCount(), SetFlags()
*/ */
wxSocketBase Peek(void* buffer, wxUint32 nbytes); wxSocketBase& Peek(void* buffer, wxUint32 nbytes);
/** /**
This function reads a buffer of @a nbytes bytes from the socket. Read up to the given number of bytes from the socket.
Use LastCount() to verify the number of bytes actually read. Use LastCount() to verify the number of bytes actually read.
Use Error() to determine if the operation succeeded. Use Error() to determine if the operation succeeded.
@@ -926,13 +927,14 @@ public:
@see Error(), LastError(), LastCount(), @see Error(), LastError(), LastCount(),
SetFlags() SetFlags()
*/ */
wxSocketBase Read(void* buffer, wxUint32 nbytes); wxSocketBase& Read(void* buffer, wxUint32 nbytes);
/** /**
This function reads a buffer sent by WriteMsg() Receive a message sent by WriteMsg().
on a socket. If the buffer passed to the function isn't big enough, the
remaining bytes will be discarded. This function always waits for the If the buffer passed to the function isn't big enough, the remaining
buffer to be entirely filled, unless an error occurs. bytes will be discarded. This function always waits for the buffer to
be entirely filled, unless an error occurs.
Use LastCount() to verify the number of bytes actually read. Use LastCount() to verify the number of bytes actually read.
@@ -953,7 +955,7 @@ public:
@see Error(), LastError(), LastCount(), SetFlags(), WriteMsg() @see Error(), LastError(), LastCount(), SetFlags(), WriteMsg()
*/ */
wxSocketBase ReadMsg(void* buffer, wxUint32 nbytes); wxSocketBase& ReadMsg(void* buffer, wxUint32 nbytes);
/** /**
Use SetFlags to customize IO operation for this socket. Use SetFlags to customize IO operation for this socket.
@@ -995,24 +997,29 @@ public:
void SetFlags(wxSocketFlags flags); void SetFlags(wxSocketFlags flags);
/** /**
This function allows you to set the local address and port, Set the local address and port to use.
useful when an application needs to reuse a particular port. When
a local port is set for a wxSocketClient, This function must always be called for the server sockets but may also
@b bind() will be called before @b connect(). be called for client sockets, if it is, @b bind() is called before @b
connect().
*/ */
bool SetLocal(const wxIPV4address& local); bool SetLocal(const wxIPV4address& local);
/** /**
This function sets the default socket timeout in seconds. This timeout Set the default socket timeout in seconds.
applies to all IO calls, and also to the Wait() family
of functions if you don't specify a wait interval. Initially, the default This timeout applies to all IO calls, and also to the Wait() family of
functions if you don't specify a wait interval. Initially, the default
timeout is 10 minutes. timeout is 10 minutes.
*/ */
void SetTimeout(int seconds); void SetTimeout(int seconds);
/** /**
This function unreads a buffer. That is, the data in the buffer is put back Put the specified data into the input queue.
in the incoming queue. This function is not affected by wxSocket flags.
The data in the buffer will be returned by the next call to Read().
This function is not affected by wxSocket flags.
If you use LastCount(), it will always return @a nbytes. If you use LastCount(), it will always return @a nbytes.
@@ -1027,19 +1034,20 @@ public:
@see Error(), LastCount(), LastError() @see Error(), LastCount(), LastError()
*/ */
wxSocketBase Unread(const void* buffer, wxUint32 nbytes); wxSocketBase& Unread(const void* buffer, wxUint32 nbytes);
/** /**
This function waits until any of the following conditions is @true: Wait for any socket event.
Possible socket events are:
@li The socket becomes readable. @li The socket becomes readable.
@li The socket becomes writable. @li The socket becomes writable.
@li An ongoing connection request has completed (wxSocketClient only) @li An ongoing connection request has completed (wxSocketClient only)
@li An incoming connection request has arrived (wxSocketServer only) @li An incoming connection request has arrived (wxSocketServer only)
@li The connection has been closed. @li The connection has been closed.
Note that it is recommended to use the individual Wait functions Note that it is recommended to use the individual @b WaitForXXX()
to wait for the required condition, instead of this one. functions to wait for the required condition, instead of this one.
@param seconds @param seconds
Number of seconds to wait. Number of seconds to wait.
@@ -1048,8 +1056,9 @@ public:
@param millisecond @param millisecond
Number of milliseconds to wait. Number of milliseconds to wait.
@return Returns @true when any of the above conditions is satisfied, @return
@false if the timeout was reached. @true when any of the above conditions is satisfied or @false if the
timeout was reached.
@see InterruptWait(), wxSocketServer::WaitForAccept(), @see InterruptWait(), wxSocketServer::WaitForAccept(),
WaitForLost(), WaitForRead(), WaitForLost(), WaitForRead(),
@@ -1058,8 +1067,10 @@ public:
bool Wait(long seconds = -1, long millisecond = 0); bool Wait(long seconds = -1, long millisecond = 0);
/** /**
This function waits until the connection is lost. This may happen if Wait until the connection is lost.
the peer gracefully closes the connection or if the connection breaks.
This may happen if the peer gracefully closes the connection or if the
connection breaks.
@param seconds @param seconds
Number of seconds to wait. Number of seconds to wait.
@@ -1076,13 +1087,16 @@ public:
bool WaitForLost(long seconds = -1, long millisecond = 0); bool WaitForLost(long seconds = -1, long millisecond = 0);
/** /**
This function waits until the socket is readable. Wait until the socket is readable.
This might mean that queued data is available for reading or, for streamed This might mean that queued data is available for reading or, for streamed
sockets, that the connection has been closed, so that a read operation will sockets, that the connection has been closed, so that a read operation will
complete immediately without blocking (unless the @b wxSOCKET_WAITALL flag complete immediately without blocking (unless the @b wxSOCKET_WAITALL flag
is set, in which case the operation might still block). is set, in which case the operation might still block).
Notice that this function should not be called if there is already data
available for reading on the socket.
@param seconds @param seconds
Number of seconds to wait. Number of seconds to wait.
If -1, it will wait for the default timeout, If -1, it will wait for the default timeout,
@@ -1097,13 +1111,16 @@ public:
bool WaitForRead(long seconds = -1, long millisecond = 0); bool WaitForRead(long seconds = -1, long millisecond = 0);
/** /**
This function waits until the socket becomes writable. Wait until the socket becomes writable.
This might mean that the socket is ready to send new data, or for streamed This might mean that the socket is ready to send new data, or for streamed
sockets, that the connection has been closed, so that a write operation is sockets, that the connection has been closed, so that a write operation is
guaranteed to complete immediately (unless the @b wxSOCKET_WAITALL flag is set, guaranteed to complete immediately (unless the @b wxSOCKET_WAITALL flag is set,
in which case the operation might still block). in which case the operation might still block).
Notice that this function should not be called if the socket is already
writable.
@param seconds @param seconds
Number of seconds to wait. Number of seconds to wait.
If -1, it will wait for the default timeout, If -1, it will wait for the default timeout,
@@ -1118,7 +1135,7 @@ public:
bool WaitForWrite(long seconds = -1, long millisecond = 0); bool WaitForWrite(long seconds = -1, long millisecond = 0);
/** /**
This function writes a buffer of @a nbytes bytes to the socket. Write up to the given number of bytes to the socket.
Use LastCount() to verify the number of bytes actually written. Use LastCount() to verify the number of bytes actually written.
@@ -1138,14 +1155,16 @@ public:
@see Error(), LastError(), LastCount(), SetFlags() @see Error(), LastError(), LastCount(), SetFlags()
*/ */
wxSocketBase Write(const void* buffer, wxUint32 nbytes); wxSocketBase& Write(const void* buffer, wxUint32 nbytes);
/** /**
This function writes a buffer of @a nbytes bytes from the socket, but it Sends a buffer which can be read using ReadMsg().
writes a short header before so that ReadMsg() knows how much data should
it actually read. So, a buffer sent with WriteMsg() MUST be read with ReadMsg().
This function always waits for the entire buffer to be sent, unless an error occurs. WriteMsg() sends a short header before the data so that ReadMsg()
knows how much data should be actually read.
This function always waits for the entire buffer to be sent, unless an
error occurs.
Use LastCount() to verify the number of bytes actually written. Use LastCount() to verify the number of bytes actually written.
@@ -1168,7 +1187,7 @@ public:
@see Error(), LastError(), LastCount(), SetFlags(), ReadMsg() @see Error(), LastError(), LastCount(), SetFlags(), ReadMsg()
*/ */
wxSocketBase WriteMsg(const void* buffer, wxUint32 nbytes); wxSocketBase& WriteMsg(const void* buffer, wxUint32 nbytes);
//@} //@}
@@ -1274,7 +1293,8 @@ public:
virtual ~wxDatagramSocket(); virtual ~wxDatagramSocket();
/** /**
This function writes a buffer of @a nbytes bytes to the socket. Write a buffer of @a nbytes bytes to the socket.
Use wxSocketBase::LastCount() to verify the number of bytes actually wrote. Use wxSocketBase::LastCount() to verify the number of bytes actually wrote.
Use wxSocketBase::Error() to determine if the operation succeeded. Use wxSocketBase::Error() to determine if the operation succeeded.