LibreOffice LibreOffice 4.1 SDK C/C++ API Reference

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
osl::StreamSocket Class Reference

`#include <socket_decl.hxx>`

Inheritance diagram for osl::StreamSocket:

## Public Member Functions
| StreamSocket (oslAddrFamily Family=osl_Socket_FamilyInet, oslProtocol Protocol=osl_Socket_ProtocolIp, oslSocketType Type=osl_Socket_TypeStream)
| Creates a socket. More...
| StreamSocket (const StreamSocket &)
| StreamSocket (oslSocket Socket, __sal_NoAcquire noacquire)
| StreamSocket (oslSocket Socket)
sal_Int32 | read (void *pBuffer, sal_uInt32 n)
| Retrieves n bytes from the stream and copies them into pBuffer. More...
sal_Int32 | write (const void *pBuffer, sal_uInt32 n)
| Writes n bytes from pBuffer to the stream. More...
sal_Int32 | recv (void *pBuffer, sal_uInt32 BytesToRead, oslSocketMsgFlag flags=osl_Socket_MsgNormal)
| Tries to receive BytesToRead data from the connected socket,. More...
sal_Int32 | send (const void *pBuffer, sal_uInt32 BytesToSend, oslSocketMsgFlag=osl_Socket_MsgNormal)
| Tries to send BytesToSend data to the connected socket. More...
Public Member Functions inherited from osl::Socket
| 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. More...
| ~Socket ()
| Destructor. More...
Socket & | operator= (oslSocket socketHandle)
| Assignment operator. More...
Socket & | operator= (const Socket &sock)
| Assignment operator. More...
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. More...
void | close ()
| Closes a socket. More...
void | getLocalAddr (SocketAddr &Addr) const
| Retrieves the address of the local interface of this socket. More...
sal_Int32 | getLocalPort () const
| Get the local port of the socket. More...
inline::rtl::OUString | getLocalHost () const
| Get the hostname for the local interface. More...
void | getPeerAddr (SocketAddr &Addr) const
| Retrieves the address of the remote host of this socket. More...
sal_Int32 | getPeerPort () const
| Get the remote port of the socket. More...
inline::rtl::OUString | getPeerHost () const
| Get the hostname for the remote interface. More...
sal_Bool | bind (const SocketAddr &LocalInterface)
| Binds the socket to the specified (local) interface. More...
sal_Bool | isRecvReady (const TimeValue *pTimeout=0) const
| Checks if read operations will block. More...
sal_Bool | isSendReady (const TimeValue *pTimeout=0) const
| Checks if send operations will block. More...
sal_Bool | isExceptionPending (const TimeValue *pTimeout=0) const
| Checks if a request for out-of-band data will block. More...
oslSocketType | getType () const
| Queries the socket for its type. More...
sal_Int32 | getOption (oslSocketOption Option, void *pBuffer, sal_uInt32 BufferLen, oslSocketOptionLevel Level=osl_Socket_LevelSocket) const
| Retrieves option-attributes associated with the socket. More...
sal_Bool | setOption (oslSocketOption Option, void *pBuffer, sal_uInt32 BufferLen, oslSocketOptionLevel Level=osl_Socket_LevelSocket) const
| Sets the sockets attributes. More...
sal_Bool | setOption (oslSocketOption option, sal_Int32 nValue)
| Convenience function for setting sal_Bool and sal_Int32 option values. More...
sal_Int32 | getOption (oslSocketOption option) const
| Convenience function for retrieving sal_Bool and sal_Int32 option values. More...
sal_Bool | enableNonBlockingMode (sal_Bool bNonBlockingMode)
| Enables/disables non-blocking mode of the socket. More...
sal_Bool | isNonBlockingMode () const
| Query blocking mode of the socket. More...
void | clearError () const
| clears the error status More...
oslSocketError | getError () const
| returns a constant decribing the last error for the socket system. More...
inline::rtl::OUString | getErrorAsString () const
| Builds a string with the last error-message for the socket. More...
oslSocket | getHandle () const
| Returns the underlying handle unacquired (The caller must acquire it to keep it). More...

## Additional Inherited Members
Protected Member Functions inherited from osl::Socket
| Socket (oslSocketType Type, oslAddrFamily Family=osl_Socket_FamilyInet, oslProtocol Protocol=osl_Socket_ProtocolIp)
| Creates a socket. More...
Protected Attributes inherited from osl::Socket
oslSocket | m_handle

## Constructor & Destructor Documentation

osl::StreamSocket::StreamSocket | ( | oslAddrFamily | Family = `osl_Socket_FamilyInet`,
|  | oslProtocol | Protocol = `osl_Socket_ProtocolIp`,
|  | oslSocketType | Type = `osl_Socket_TypeStream`
| ) |  |
| inline

Creates a socket.

Parameters

  Family | the Family of the socket (Inet by default)
  Protocol | the Protocon of the socket (IP by default)
  Type | For some protocols it might be desirable to use a different type than `osl_Socket_TypeStream` (like `osl_Socket_TypeSeqPacket`). Therefore this parameter is not hidden.

osl::StreamSocket::StreamSocket | ( | const StreamSocket & | socket | ) |
| inline

osl::StreamSocket::StreamSocket | ( | oslSocket | Socket,
|  | __sal_NoAcquire | noacquire
| ) |  |
| inline

osl::StreamSocket::StreamSocket | ( | oslSocket | Socket | ) |
| inline

## Member Function Documentation

sal_Int32 osl::StreamSocket::read | ( | void * | pBuffer,
|  | sal_uInt32 | n
| ) |  |
| inline

Retrieves n bytes from the stream and copies them into pBuffer.

The method avoids incomplete reads due to packet boundaries and is thus blocking.

Parameters

  pBuffer | receives the read data. pBuffer must be large enough to hold n bytes.
  n | the number of bytes to read.

Returns
  the number of read bytes. The number will only be smaller than n if an exceptional condition (e.g. connection closed) occurs.

sal_Int32 osl::StreamSocket::recv | ( | void * | pBuffer,
|  | sal_uInt32 | BytesToRead,
|  | oslSocketMsgFlag | flags = `osl_Socket_MsgNormal`
| ) |  |
| inline

Tries to receive BytesToRead data from the connected socket,.

Parameters

  [out] | pBuffer | Points to a buffer that will be filled with the received data. pBuffer must have at least have a size of BytesToRead.
  [in] | BytesToRead | The number of bytes to read.
  [in] | flags | Modifier for the call. Valid values are:

- `osl_Socket_MsgNormal`
- `osl_Socket_MsgOOB`
- `osl_Socket_MsgPeek`
- `osl_Socket_MsgDontRoute`
- `osl_Socket_MsgMaxIOVLen`

Returns
  the number of received bytes, which may be less than BytesToRead.

sal_Int32 osl::StreamSocket::send | ( | const void * | pBuffer,
|  | sal_uInt32 | BytesToSend,
|  | oslSocketMsgFlag | Flag = `osl_Socket_MsgNormal`
| ) |  |
| inline

Tries to send BytesToSend data to the connected socket.

Parameters

  pBuffer | [in] Points to a buffer that contains the send-data.
  BytesToSend | [in] The number of bytes to send. pBuffer must have at least this size.
  Flag | [in] Modifier for the call. Valid values are: `osl_Socket_MsgNormal` `osl_Socket_MsgOOB` `osl_Socket_MsgPeek` `osl_Socket_MsgDontRoute` `osl_Socket_MsgMaxIOVLen`

Returns
  the number of transfered bytes. It may be less than BytesToSend.

sal_Int32 osl::StreamSocket::write | ( | const void * | pBuffer,
|  | sal_uInt32 | n
| ) |  |
| inline

Writes n bytes from pBuffer to the stream.

The method avoids incomplete writes due to packet boundaries and is thus blocking.

Parameters

  pBuffer | contains the data to be written.
  n | the number of bytes to write.

Returns
  the number of written bytes. The number will only be smaller than n if an exceptional condition (e.g. connection closed) occurs.

The documentation for this class was generated from the following files:

- osl/socket_decl.hxx
- osl/socket.hxx