LibreOffice: osl::AcceptorSocket Class Reference

LibreOffice LibreOffice 26.2 SDK C/C++ API Reference

Loading...
Searching...
No Matches
osl::AcceptorSocket Class Reference

Allows to accept socket connections. More...

`#include <socket_decl.hxx>`

Inheritance diagram for osl::AcceptorSocket:

## Public Member Functions
| AcceptorSocket (oslAddrFamily Family=osl_Socket_FamilyInet, oslProtocol Protocol=osl_Socket_ProtocolIp, oslSocketType Type=osl_Socket_TypeStream)
bool | listen (sal_Int32 MaxPendingConnections=-1)
| Prepare a socket for the accept-call.
oslSocketResult | acceptConnection (StreamSocket &Connection)
| Accepts incoming connections on the socket.
oslSocketResult | acceptConnection (StreamSocket &Connection, SocketAddr &PeerAddr)
| Accepts incoming connections on the socket.
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.
| ~Socket ()
| Destructor.
Socket & | operator= (oslSocket socketHandle)
| Assignment operator.
Socket & | operator= (const Socket &sock)
| Assignment operator.
bool | operator== (const Socket &rSocket) const
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.
bool | bind (const SocketAddr &LocalInterface)
| Binds the socket to the specified (local) interface.
bool | isRecvReady (const TimeValue *pTimeout=NULL) const
| Checks if read operations will block.
bool | isSendReady (const TimeValue *pTimeout=NULL) const
| Checks if send operations will block.
bool | isExceptionPending (const TimeValue *pTimeout=NULL) 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.
bool | setOption (oslSocketOption Option, void *pBuffer, sal_uInt32 BufferLen, oslSocketOptionLevel Level=osl_Socket_LevelSocket) const
| Sets the sockets attributes.
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.
bool | enableNonBlockingMode (bool bNonBlockingMode)
| Enables/disables non-blocking mode of the socket.
bool | isNonBlockingMode () const
| Query blocking mode of the socket.
void | clearError () const
| clears the error status
oslSocketError | getError () const
| returns a constant describing 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).

## 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.
Protected Attributes inherited from osl::Socket
oslSocket | m_handle

## Detailed Description

Allows to accept socket connections.

## Constructor & Destructor Documentation

## ◆ AcceptorSocket()

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

## Member Function Documentation

## ◆ acceptConnection() [1/2]

oslSocketResult osl::AcceptorSocket::acceptConnection | ( | StreamSocket & | Connection | ) |
| inline

Accepts incoming connections on the socket.

You must precede this call with osl::Socket::bind() and listen().

Parameters

  Connection | receives the incoming connection.

Returns
  `osl_Socket_Ok`, if a connection has been accepted, `osl_Socket_TimedOut`, if m_RecvTimeout milliseconds passed without connect, `osl_Socket_Error` on errors.

## ◆ acceptConnection() [2/2]

oslSocketResult osl::AcceptorSocket::acceptConnection | ( | StreamSocket & | Connection,
|  | SocketAddr & | PeerAddr )
| inline

Accepts incoming connections on the socket.

You must precede this call with osl::Socket::bind() and listen().

Parameters

  PeerAddr | receives the address of the connecting entity (your communication partner).
  Connection | receives the incoming connection.

Returns
  `osl_Socket_Ok`, if a connection has been accepted, `osl_Socket_TimedOut`, if m_RecvTimeout milliseconds passed without connect, `osl_Socket_Error` on errors.

## ◆ listen()

bool osl::AcceptorSocket::listen | ( | sal_Int32 | MaxPendingConnections = -1 | ) |
| inline

Prepare a socket for the accept-call.

The socket must have been bound before to the local address.

Parameters

  MaxPendingConnections | The maximum number of pending connections (waiting to be accepted) on this socket. If you use -1, a system default value is used.

Returns
  `true` if call was successful.

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

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