UDK 3.2.7 C/C++ API Reference
|
#include <socket_decl.hxx>
Public Member Functions | |
Socket () | |
Socket (const Socket &socket) | |
Socket (oslSocket socketHandle) | |
Socket (oslSocket socketHandle, __sal_NoAcquire noacquire) | |
The instance takes over the handle's ownership without acquiring the handle, but releases it within the dtor. | |
~Socket () | |
Destructor. | |
Socket & | operator= (oslSocket socketHandle) |
Assignment operator. | |
Socket & | operator= (const Socket &sock) |
Assignment operator. | |
sal_Bool | operator== (const Socket &rSocket) const |
sal_Bool | operator== (const oslSocket socketHandle) const |
void | shutdown (oslSocketDirection Direction=osl_Socket_DirReadWrite) |
Closes a definite or both directions of the bidirectional stream. | |
void | close () |
Closes a socket. | |
void | getLocalAddr (SocketAddr &Addr) const |
Retrieves the address of the local interface of this socket. | |
sal_Int32 | getLocalPort () const |
Get the local port of the socket. | |
inline::rtl::OUString | getLocalHost () const |
Get the hostname for the local interface. | |
void | getPeerAddr (SocketAddr &Addr) const |
Retrieves the address of the remote host of this socket. | |
sal_Int32 | getPeerPort () const |
Get the remote port of the socket. | |
inline::rtl::OUString | getPeerHost () const |
Get the hostname for the remote interface. | |
sal_Bool | bind (const SocketAddr &LocalInterface) |
Binds the socket to the specified (local) interface. | |
sal_Bool | isRecvReady (const TimeValue *pTimeout=0) const |
Checks if read operations will block. | |
sal_Bool | isSendReady (const TimeValue *pTimeout=0) const |
Checks if send operations will block. | |
sal_Bool | isExceptionPending (const TimeValue *pTimeout=0) const |
Checks if a request for out-of-band data will block. | |
oslSocketType | getType () const |
Queries the socket for its type. | |
sal_Int32 | getOption (oslSocketOption Option, void *pBuffer, sal_uInt32 BufferLen, oslSocketOptionLevel Level=osl_Socket_LevelSocket) const |
Retrieves option-attributes associated with the socket. | |
sal_Bool | setOption (oslSocketOption Option, void *pBuffer, sal_uInt32 BufferLen, oslSocketOptionLevel Level=osl_Socket_LevelSocket) const |
Sets the sockets attributes. | |
sal_Bool | setOption (oslSocketOption option, sal_Int32 nValue) |
Convenience function for setting sal_Bool and sal_Int32 option values. | |
sal_Int32 | getOption (oslSocketOption option) const |
Convenience function for retrieving sal_Bool and sal_Int32 option values. | |
sal_Bool | enableNonBlockingMode (sal_Bool bNonBlockingMode) |
Enables/disables non-blocking mode of the socket. | |
sal_Bool | isNonBlockingMode () const |
Query blocking mode of the socket. | |
void | clearError () const |
clears the error status | |
oslSocketError | getError () const |
returns a constant decribing the last error for the socket system. | |
inline::rtl::OUString | getErrorAsString () const |
Builds a string with the last error-message for the socket. | |
oslSocket | getHandle () const |
Returns the underlying handle unacquired (The caller must acquire it to keep it). | |
Protected Member Functions | |
Socket (oslSocketType Type, oslAddrFamily Family=osl_Socket_FamilyInet, oslProtocol Protocol=osl_Socket_ProtocolIp) | |
Creates a socket. | |
Protected Attributes | |
oslSocket | m_handle |
osl::Socket::Socket | ( | oslSocketType | Type, |
oslAddrFamily | Family = osl_Socket_FamilyInet , |
||
oslProtocol | Protocol = osl_Socket_ProtocolIp |
||
) | [inline, protected] |
Creates a socket.
Note it's protected.
Type | |
Family | |
Protocol |
osl::Socket::Socket | ( | ) | [inline] |
osl::Socket::Socket | ( | const Socket & | socket | ) | [inline] |
osl::Socket::Socket | ( | oslSocket | socketHandle | ) | [inline] |
osl::Socket::Socket | ( | oslSocket | socketHandle, |
__sal_NoAcquire | noacquire | ||
) | [inline] |
The instance takes over the handle's ownership without acquiring the handle, but releases it within the dtor.
noacquire | use SAL_NO_ACQUIRE |
osl::Socket::~Socket | ( | ) | [inline] |
Destructor.
Releases the underlying handle
sal_Bool osl::Socket::bind | ( | const SocketAddr & | LocalInterface | ) | [inline] |
Binds the socket to the specified (local) interface.
LocalInterface | Address of the Interface |
void osl::Socket::clearError | ( | ) | const [inline] |
clears the error status
void osl::Socket::close | ( | ) | [inline] |
Closes a socket.
Note that closing a socket is identical to shutdown( osl_Socket_DirReadWrite ), as the operating system distinguish both cases, both functions or offered in this API.
Enables/disables non-blocking mode of the socket.
bNonBlockingMode | If sal_True , blocking mode will be switched off If sal_False , the socket will become a blocking socket (which is the default behaviour of a socket). |
sal_True
if mode could be set. oslSocketError osl::Socket::getError | ( | ) | const [inline] |
returns a constant decribing the last error for the socket system.
rtl::OUString osl::Socket::getErrorAsString | ( | ) | const [inline] |
Builds a string with the last error-message for the socket.
oslSocket osl::Socket::getHandle | ( | ) | const [inline] |
Returns the underlying handle unacquired (The caller must acquire it to keep it).
void osl::Socket::getLocalAddr | ( | SocketAddr & | Addr | ) | const [inline] |
Retrieves the address of the local interface of this socket.
Addr | [out] receives the address. |
rtl::OUString osl::Socket::getLocalHost | ( | ) | const [inline] |
Get the hostname for the local interface.
sal_Int32 osl::Socket::getLocalPort | ( | ) | const [inline] |
Get the local port of the socket.
Usually used after bind().
sal_Int32 osl::Socket::getOption | ( | oslSocketOption | Option, |
void * | pBuffer, | ||
sal_uInt32 | BufferLen, | ||
oslSocketOptionLevel | Level = osl_Socket_LevelSocket |
||
) | const [inline] |
Retrieves option-attributes associated with the socket.
Option | The attribute to query. Valid values (depending on the Level) are:
|
If not above mentioned otherwise, the options are only valid for level osl_Socket_LevelSocket
.
pBuffer | The Buffer will be filled with the attribute. |
BufferLen | The size of pBuffer. |
Level | The option level. |
Valid values are:
osl_Socket_LevelSocket
: Socket Level osl_Socket_LevelTcp
: Level of Transmission Control Protocol sal_Int32 osl::Socket::getOption | ( | oslSocketOption | option | ) | const [inline] |
Convenience function for retrieving sal_Bool and sal_Int32 option values.
void osl::Socket::getPeerAddr | ( | SocketAddr & | Addr | ) | const [inline] |
Retrieves the address of the remote host of this socket.
Addr | [out] receives the address. |
rtl::OUString osl::Socket::getPeerHost | ( | ) | const [inline] |
Get the hostname for the remote interface.
sal_Int32 osl::Socket::getPeerPort | ( | ) | const [inline] |
Get the remote port of the socket.
oslSocketType osl::Socket::getType | ( | ) | const [inline] |
Queries the socket for its type.
osl_Socket_TypeStream
osl_Socket_TypeDgram
osl_Socket_TypeRaw
osl_Socket_TypeRdm
osl_Socket_TypeSeqPacket
osl_invalid_SocketType
, if an error occurred Checks if a request for out-of-band data will block.
You can specify a timeout-value in seconds/nanoseconds that denotes how the operation will block if the Socket has no pending OOB data.
sal_True
if OOB-request operations (recv with appropriate flags) on the Socket will NOT block; sal_False
if it would block or if an error occurred.pTimeout | if 0, the operation will block without a timeout. Otherwise the specified amout of time. |
sal_Bool osl::Socket::isNonBlockingMode | ( | ) | const [inline] |
Query blocking mode of the socket.
sal_True
if non-blocking mode is set. Checks if read operations will block.
You can specify a timeout-value in seconds/nanoseconds that denotes how the operation will block if the Socket is not ready.
sal_True
if read operations (recv, recvFrom, accept) on the Socket will NOT block; sal_False
if it would block or if an error occurred.pTimeout | if 0, the operation will block without a timeout. Otherwise the specified amout of time. |
Checks if send operations will block.
You can specify a timeout-value in seconds/nanoseconds that denotes how the operation will block if the Socket is not ready.
sal_True
if send operations (send, sendTo) on the Socket will NOT block; sal_False
if it would block or if an error occurred.pTimeout | if 0, the operation will block without a timeout. Otherwise the specified amout of time. |
Assignment operator.
If socket was already created, the old one will be discarded.
Assignment operator.
If socket was already created, the old one will be discarded.
sal_True
, when the underlying handle of both Socket instances are identical, sal_False
otherwise. sal_True
, when the underlying handle of both Socket instances are identical, sal_False
otherwise. sal_Bool osl::Socket::setOption | ( | oslSocketOption | option, |
sal_Int32 | nValue | ||
) | [inline] |
Convenience function for setting sal_Bool and sal_Int32 option values.
sal_Bool osl::Socket::setOption | ( | oslSocketOption | Option, |
void * | pBuffer, | ||
sal_uInt32 | BufferLen, | ||
oslSocketOptionLevel | Level = osl_Socket_LevelSocket |
||
) | const [inline] |
Sets the sockets attributes.
Option | denotes the option to modify. Valid values (depending on the Level) are:
|
If not above mentioned otherwise, the options are only valid for level osl_Socket_LevelSocket.
pBuffer | Pointer to a Buffer which contains the attribute-value. |
BufferLen | contains the length of the Buffer. |
Level | selects the level for which an option should be changed. Valid values are:
|
void osl::Socket::shutdown | ( | oslSocketDirection | Direction = osl_Socket_DirReadWrite | ) | [inline] |
Closes a definite or both directions of the bidirectional stream.
Direction |
oslSocket osl::Socket::m_handle [protected] |