The Free and Open Productivity Suite
Follow us on Twitter: @ApacheOO

Developer's Guide

API

SDK

Tips 'n' Tricks

Miscellaneous


Global Functions in Global Namespace C++
in Sourcefile socket.h


osl_acceptConnectionOnSocket
extern "C"
oslSocket osl_acceptConnectionOnSocket(
oslSocket Socket,
oslSocketAddr * pAddr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Waits for an ingoing connection on the socket. This call blocks if there is no incoming connection present.
Parameters
pAddr
if pAddr is != 0, the peers address is returned.
Return
0 if the accept-call failed, otherwise you get a socket representing the new connection.

osl_acquireSocket
extern "C"
void osl_acquireSocket(
oslSocket Socket );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
increases the refcount of the socket handle by one

osl_addToSocketSet
extern "C"
void osl_addToSocketSet(
oslSocketSet Set,
oslSocket Socket );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Adds a socket to the set.
Parameters
Set
the set were the socket is added.
Socket
the socket to be added.

osl_bindAddrToSocket
extern "C"
sal_Bool osl_bindAddrToSocket(
oslSocket Socket,
oslSocketAddr Addr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Binds the given address to the socket.
Parameters
Socket
Address
Return
sal_False if the bind failed, sal_True if successful.
See Also
osl_getLastSocketError()

osl_clearSocketSet
extern "C"
void osl_clearSocketSet(
oslSocketSet Set );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Clears the set from all previously added sockets.
Parameters
Set
the set to be cleared.

osl_closeSocket
extern "C"
void osl_closeSocket(
oslSocket Socket );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Closes the socket terminating any ongoing dataflow.

osl_connectSocketTo
extern "C"
oslSocketResult osl_connectSocketTo(
oslSocket Socket,
oslSocketAddr Addr,
const TimeValue * pTimeout );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Connects the socket to the given address.
Parameters
Socket
a bound socket.
    
Addr
the peer address.
    
pTimeout
Timeout value or NULL for blocking.
    
    
Return
osl_Socket_Ok on successful connection, osl_Socket_TimedOut if operation timed out, osl_Socket_Interrupted if operation was interrupted osl_Socket_Error if the connection failed.

osl_copyHostAddr
extern "C"
oslHostAddr osl_copyHostAddr(
const oslHostAddr Addr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Create a copy of the given Addr.
Return
The copied address or 0 upon failure.

osl_copySocketAddr
extern "C"
oslSocketAddr osl_copySocketAddr(
oslSocketAddr Addr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Creates a new SocketAddress and fills it from Addr.

osl_createEmptySocketAddr
extern "C"
oslSocketAddr osl_createEmptySocketAddr(
oslAddrFamily Family );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Creates a socket-address for the given family.
Parameters
family
If family == osl_Socket_FamilyInet the address is
              set to INADDR_ANY    port 0.
Return
0 if address could not be created.

osl_createHostAddr
extern "C"
oslHostAddr osl_createHostAddr(
rtl_uString * strHostname,
const oslSocketAddr Addr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Create an oslHostAddr from given hostname and socket address.
Parameters
strHostname
The hostname to be stored.
Addr
The socket address to be stored.
Return
The created address or 0 upon failure.

osl_createHostAddrByAddr
extern "C"
oslHostAddr osl_createHostAddrByAddr(
const oslSocketAddr Addr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Create an oslHostAddr by reverse resolution of the given Addr. Successful name resolution should result in the fully qualified domain name (FQDN) and it's address as hostname and socket address members of the resulting oslHostAddr.
Parameters
Addr
The socket address to be reverse resolved.
Return
The resulting address or 0 upon failure.

osl_createHostAddrByName
extern "C"
oslHostAddr osl_createHostAddrByName(
rtl_uString * strHostname );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Create an oslHostAddr by resolving the given strHostname. Successful name resolution should result in the fully qualified domain name (FQDN) and it's address as hostname and socket address members of the resulting oslHostAddr.
Parameters
strHostname
The hostname to be resolved.
Return
The resulting address or 0 upon failure.

osl_createInetBroadcastAddr
extern "C"
oslSocketAddr osl_createInetBroadcastAddr(
rtl_uString * strDottedAddr,
sal_Int32 Port );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Create an internet address usable for sending broadcast datagrams. To limit the broadcast to your subnet, pass your hosts IP address in dotted decimal notation as first argument.
See Also
osl_sendToSocket()
oslSocketAddr
Parameters
strDottedAddr
dotted decimal internet address, may be 0.
Port
port number in host byte order.
Return
0 if address could not be created.

osl_createInetSocketAddr
extern "C"
oslSocketAddr osl_createInetSocketAddr(
rtl_uString * strDottedAddr,
sal_Int32 Port );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Create an internet-address, consisting of hostaddress and port. We interpret strDottedAddr as a dotted-decimal inet-addr (e.g. "141.99.128.50").
Parameters
strDottedAddr
String with dotted address.
Port
portnumber in host byte order.
Return
0 if address could not be created.

osl_createSocket
extern "C"
oslSocket osl_createSocket(
oslAddrFamily Family,
oslSocketType Type,
oslProtocol Protocol );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Create a socket of the specified Family and Type. The semantic of the Protocol parameter depends on the given family and type.
Return
0 if socket could not be created, otherwise you get a handle to the allocated socket-datastructure.

osl_createSocketSet
extern "C"
oslSocketSet osl_createSocketSet(
void );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Creates a set of sockets to be used with osl_demultiplexSocketEvents().
Return
A oslSocketSet or 0 if creation failed.

osl_demultiplexSocketEvents
extern "C"
sal_Int32 osl_demultiplexSocketEvents(
oslSocketSet IncomingSet,
oslSocketSet OutgoingSet,
oslSocketSet OutOfBandSet,
const TimeValue * pTimeout );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Checks multiple sockets for events.
Parameters
IncomingSet
Checks the sockets in this set
for incoming events (read, accept). If the set is 0,
it is just skipped.
OutgoingSet
Checks the sockets in this set
for outgoing events (write, connect). If the set is 0,
it is just skipped.
OutOfBandSet
Checks the sockets in this set
for out-of-band events. If the set is 0, it is just skipped.
msTimeout
Number of milliseconds to wait for events. If
msTimeout is -1, the call will block until an event or an error
occurs.
Return
-1 on errors, otherwise the number of sockets with pending events. In case of timeout, the number might be 0.

osl_destroyHostAddr
extern "C"
void osl_destroyHostAddr(
oslHostAddr Addr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Frees all resources allocated by Addr. The handle Addr must not be used after the call anymore.

osl_destroySocketAddr
extern "C"
void osl_destroySocketAddr(
oslSocketAddr Addr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Frees all resources allocated by Addr. The handle Addr must not be used after the call anymore.

osl_destroySocketSet
extern "C"
void osl_destroySocketSet(
oslSocketSet Set );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Destroys a oslSocketSet.

osl_enableNonBlockingMode
extern "C"
sal_Bool osl_enableNonBlockingMode(
oslSocket Socket,
sal_Bool On );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Enables/disables non-blocking-mode of the socket.
Parameters
Socket
Change mode for this socket.
On
sal_True enables non-blocking mode,
          sal_False disables non-blocking mode.
Return
sal_True if mode could be changed.

osl_getAddrOfSocketAddr
extern "C"
oslSocketResult osl_getAddrOfSocketAddr(
oslSocketAddr Addr,
sal_Sequence * * ppByteSeq );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Returns the addr field in the struct sockaddr.
Parameters
ppByteSeq
out parameter. After the call, *ppByteSeq contains the ipadrress
                 in network byteorder. *ppByteSeq may be 0 in case of an invalid socket handle.
Return
osl_Socket_Ok or osl_Socket_Error

osl_getDottedInetAddrOfSocketAddr
extern "C"
oslSocketResult osl_getDottedInetAddrOfSocketAddr(
oslSocketAddr Addr,
rtl_uString * * strDottedInetAddr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Gets the address in dotted decimal format.
Parameters
strDottedInetAddr
out-parameter. Contains the dotted decimal address
(e.g. 141.99.20.34) represented    by the address.
If the address is invalid or not of type osl_Socket_FamilyInet,
it returns 0.
Return
osl_Socket_Ok or osl_Socket_Error

osl_getFamilyOfSocketAddr
extern "C"
oslAddrFamily osl_getFamilyOfSocketAddr(
oslSocketAddr Addr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Retrieves the address-family from the Addr.
Return
the family of the socket-address. In case of an unknown family you get osl_Socket_FamilyInvalid.

osl_getHostnameOfHostAddr
extern "C"
void osl_getHostnameOfHostAddr(
const oslHostAddr Addr,
rtl_uString * * strHostname );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Get the hostname member of Addr.
Return
The hostname or 0 upon failure.

osl_getHostnameOfSocketAddr
extern "C"
oslSocketResult osl_getHostnameOfSocketAddr(
oslSocketAddr Addr,
rtl_uString * * strHostname );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Returns the hostname represented by Addr.
Parameters
strHostname
out-parameter. The hostname represented by the address. If
there is no hostname to be found, it returns 0.

osl_getInetPortOfSocketAddr
extern "C"
sal_Int32 osl_getInetPortOfSocketAddr(
oslSocketAddr Addr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Retrieves the internet port-number of Addr.
Return
the port-number of the address in host-byte order. If Addr is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT

osl_getLastSocketError
extern "C"
oslSocketError osl_getLastSocketError(
oslSocket Socket );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
returns a constant decribing the last error for the socket system.
Return
osl_Socket_E_NONE if no error occured, osl_invalid_SocketError if an unknown (unmapped) error occured, otherwise an enum describing the error.

osl_getLastSocketErrorDescription
extern "C"
void osl_getLastSocketErrorDescription(
oslSocket Socket,
rtl_uString * * strError );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
returns a string which describes the last socket error.
Parameters
strError
out-parameter. The string that receives the error message.

osl_getLocalAddrOfSocket
extern "C"
oslSocketAddr osl_getLocalAddrOfSocket(
oslSocket Socket );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Retrieves the Address of the local end of the socket. Note that a socket must be bound or connected before a vaild address can be returned.
Return
0 if socket-address could not be created, otherwise you get the created Socket-Address.

osl_getLocalHostname
extern "C"
oslSocketResult osl_getLocalHostname(
rtl_uString * * strLocalHostname );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Retrieve this machines hostname. May not always be a fully qualified domain name (FQDN).
Parameters
strLocalHostname
out-parameter. The string that receives the local host name.
Return
sal_True upon success, sal_False otherwise.

osl_getPeerAddrOfSocket
extern "C"
oslSocketAddr osl_getPeerAddrOfSocket(
oslSocket Socket );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Retrieves the Address of the remote end of the socket. Note that a socket must be connected before a vaild address can be returned.
Return
0 if socket-address could not be created, otherwise you get the created Socket-Address.

osl_getServicePort
extern "C"
sal_Int32 osl_getServicePort(
rtl_uString * strServicename,
rtl_uString * strProtocol );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Looks up the port-number designated to the specified service/protocol-pair. (e.g. "ftp" "tcp").
Return
OSL_INVALID_PORT if no appropriate entry was found, otherwise the port-number.

osl_getSocketAddrOfHostAddr
extern "C"
oslSocketAddr osl_getSocketAddrOfHostAddr(
const oslHostAddr Addr );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Get the socket address member of Addr.
Return
The socket address or 0 upon failure.

osl_getSocketOption
extern "C"
sal_Int32 osl_getSocketOption(
oslSocket Socket,
oslSocketOptionLevel Level,
oslSocketOption Option,
void * pBuffer,
sal_uInt32 BufferLen );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Retrieves attributes associated with the socket.
Parameters
Socket
is the socket to query.

Level
selects the level for which an option should be queried.
Valid values are:
  • osl_sol_socket: Socket Level
  • osl_sol_tcp: Level of Transmission Control Protocol
Option
denotes the option to query.
Valid values (depending on the Level) are:
  • osl_Socket_Option_Debug
    (sal_Bool) Socket debug flag 1 = enabled, 0 = disabled.
  • osl_Socket_OptionAcceptConn
  • osl_Socket_OptionReuseAddr
    (sal_Bool) Allows the socket to be bound to an address that is already in use. 1 = multiple bound allowed, 0 = no multiple bounds allowed
  • osl_Socket_OptionKeepAlive
    (sal_Bool) Keepalive packets are sent by the underlying socket. 1 = enabled, 0 = disabled
  • osl_Socket_OptionDontRoute
    (sal_Bool) Do not route: send directly to interface. 1 = do not route , 0 = routing possible
  • osl_Socket_OptionBroadcast
    (sal_Bool) Transmission of broadcast messages are allowed on the socket. 1 = transmission allowed, 0 = transmission disallowed
  • osl_Socket_OptionUseLoopback
  • osl_Socket_OptionLinger
    (sal_Int32) Linger on close if unsent data is present. 0 = linger is off, > 0 = timeout in seconds.
  • osl_Socket_OptionOOBinLine
  • osl_Socket_OptionSndBuf
    (sal_Int32) Size of the send buffer in bytes. Data is sent after SndTimeo or when the buffer is full. This allows faster writing to the socket.
  • osl_Socket_OptionRcvBuf
    (sal_Int32) Size of the receive buffer in bytes. Data is sent after SndTimeo or when the buffer is full. This allows faster writing to the socket and larger packet sizes.
  • osl_Socket_OptionSndLowat
  • osl_Socket_OptionRcvLowat
  • osl_Socket_OptionSndTimeo
    (sal_Int32) Data is sent after this timeout. This allows gathering of data to send larger packages but increases latency times.
  • osl_Socket_OptionRcvTimeo
  • osl_Socket_OptionError
  • osl_Socket_OptionType
  • osl_Socket_OptionTcpNoDelay
    Disables the Nagle algorithm for send coalescing. (Do not collect data until a packet is full, instead send immediatly. This increases network traffic but might improve latency-times.) 1 = disables the algorithm, 0 = keeps it enabled.
If not above mentioned otherwise, the options are only valid for level osl_Socket_LevelSocket.
pBuffer
Pointer to a buffer large enough to take the desired
attribute-value.

BufferSize
contains the length of the Buffer.

Return
-1 if an error occured or else the size of the data copied into pBuffer.
See Also
osl_setSocketOption()

osl_getSocketType
extern "C"
oslSocketType osl_getSocketType(
oslSocket Socket );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Queries the socket for its type.
Return
one of:
  • osl_Socket_TypeStream
  • osl_Socket_TypeDgram
  • osl_Socket_TypeRaw
  • osl_Socket_TypeRdm
  • osl_Socket_TypeSeqPacket
  • osl_invalid_SocketType, if an error occured

osl_isEqualSocketAddr
extern "C"
sal_Bool osl_isEqualSocketAddr(
oslSocketAddr Addr1,
oslSocketAddr Addr2 );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Compares the values of two SocketAddresses.
Return
sal_True if both addresses denote the same socket address, sal_False otherwise.

osl_isExceptionPending
extern "C"
sal_Bool osl_isExceptionPending(
oslSocket Socket,
const TimeValue * pTimeout );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Checks if a request for out-of-band data will block. You can specify a timeout-value in seconds/microseconds that denotes how long the operation will block if the Socket has no pending OOB data.
Return
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 occured.
Parameters
Socket
the Socket to perfom the operation on.
pTimeout
if NULL, the operation will block without a timeout. 

osl_isInSocketSet
extern "C"
sal_Bool osl_isInSocketSet(
oslSocketSet Set,
oslSocket Socket );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Checks if socket is in the set.
Parameters
Set
the set to be checked.
Socket
check if this socket is in the set.
Return
sal_True if socket is in the set.

osl_isNonBlockingMode
extern "C"
sal_Bool osl_isNonBlockingMode(
oslSocket Socket );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Query state of non-blocking-mode of the socket.
Parameters
Socket
Query mode for this socket.
Return
True if non-blocking-mode is enabled.

osl_isReceiveReady
extern "C"
sal_Bool osl_isReceiveReady(
oslSocket Socket,
const TimeValue * pTimeout );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Checks if read operations will block.
Description
You can specify a timeout-value in seconds/microseconds that denotes how long the operation will block if the Socket is not ready.
Return
sal_True if read operations (recv, recvFrom, accept) on the Socket will NOT block; sal_False if it would block or if an error occured.
Parameters
Socket
the Socket to perfom the operation on.
pTimeout
if NULL, the operation will block without a timeout. 

osl_isSendReady
extern "C"
sal_Bool osl_isSendReady(
oslSocket Socket,
const TimeValue * pTimeout );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Checks if send operations will block. You can specify a timeout-value in seconds/microseconds that denotes how long the operation will block if the Socket is not ready.
Return
sal_True if send operations (send, sendTo) on the Socket will NOT block; sal_False if it would block or if an error occured.
Parameters
Socket
the Socket to perfom the operation on.
pTimeout
if NULL, the operation will block without a timeout. Otherwise
the time define by timeout value.

osl_listenOnSocket
extern "C"
sal_Bool osl_listenOnSocket(
oslSocket Socket,
sal_Int32 MaxPendingConnections );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Prepares the socket to act as an acceptor of incoming connections. You should call "listen" before you use "accept".
Parameters
MaxPendingConnections
denotes the length of the queue of
pending connections for this socket. If MaxPendingConnections is
-1, the systems default value will be used (Usually 5).
Return
sal_False if the listen failed.

osl_readSocket
extern "C"
sal_Int32 osl_readSocket(
oslSocket Socket,
void * pBuffer,
sal_Int32 nSize );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Retrieves n bytes from the stream and copies them into pBuffer. The function avoids incomplete reads due to packet boundaries.
Parameters
pBuffer
receives the read data.
n
the number of bytes to read. pBuffer must be large enough
to hold the n bytes!
Return
the number of read bytes. The number will only be smaller than n if an exceptional condition (e.g. connection closed) occurs.

osl_receiveFromSocket
extern "C"
sal_Int32 osl_receiveFromSocket(
oslSocket Socket,
oslSocketAddr SenderAddr,
void * pBuffer,
sal_uInt32 BufferSize,
oslSocketMsgFlag Flag );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Tries to receives BufferSize data from the (usually unconnected) (datagram-)socket, if no error occurs.
Parameters
Socket
A bound socket to be used to listen for a datagram.
pSenderAddr
An pointer to a created oslSocketAddr handle
or to a null handle. After the call, it will contain the constructed
oslSocketAddr of the datagrams sender. If pSenderAddr itself is 0,
it is ignored.
pBuffer
Points to a buffer that will be filled with the received
datagram.
BufferSize
The size of pBuffer.
Flag
Modifier for the call. Valid values are:
  • osl_Socket_MsgNormal
  • osl_Socket_MsgOOB
  • osl_Socket_MsgPeek
  • osl_Socket_MsgDontRoute
  • osl_Socket_MsgMaxIOVLen
Return
the number of received bytes.

osl_receiveSocket
extern "C"
sal_Int32 osl_receiveSocket(
oslSocket Socket,
void * pBuffer,
sal_uInt32 BytesToRead,
oslSocketMsgFlag Flag );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Tries to receive BytesToRead data from the connected socket, if no error occurs. Note that incomplete recvs due to packet boundaries may occur.
Parameters
Socket
A connected socket to be used to listen on.
pBuffer
Points to a buffer that will be filled with the received
data.
BytesToRead
The number of bytes to read. pBuffer must have at least
this size.
Flag
Modifier for the call. Valid values are:
  • osl_Socket_MsgNormal
  • osl_Socket_MsgOOB
  • osl_Socket_MsgPeek
  • osl_Socket_MsgDontRoute
  • osl_Socket_MsgMaxIOVLen
Return
the number of received bytes.

osl_releaseSocket
extern "C"
void osl_releaseSocket(
oslSocket Socket );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
decreases the refcount of the socket handle by one.
Description
If the refcount drops to zero, the underlying socket handle is destroyed and becomes invalid.

osl_removeFromSocketSet
extern "C"
void osl_removeFromSocketSet(
oslSocketSet Set,
oslSocket Socket );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Removes a socket from the set.
Parameters
Set
the set were the socket is removed from.
Socket
the socket to be removed.

osl_resolveHostname
extern "C"
oslSocketAddr osl_resolveHostname(
rtl_uString * strHostname );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Uses the systems name-service interface to find an address for strHostname.
Parameters
strHostname
The name for which you search for an address.
Return
The desired address if one could be found, otherwise 0. Don't forget to destroy the address if you don't need it any longer.

osl_sendSocket
extern "C"
sal_Int32 osl_sendSocket(
oslSocket Socket,
const void * pBuffer,
sal_uInt32 BytesToSend,
oslSocketMsgFlag Flag );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Tries to send BytesToSend data from the connected socket, if no error occurs.
Parameters
Socket
A connected socket.
pBuffer
Points to a buffer that contains the send-data.
BytesToSend
The number of bytes to send. pBuffer must have at least
this size.
Flag
Modifier for the call. Valid values are:
  • osl_Socket_MsgNormal
  • osl_Socket_MsgOOB
  • osl_Socket_MsgPeek
  • osl_Socket_MsgDontRoute
  • osl_Socket_MsgMaxIOVLen
Return
the number of transfered bytes.

osl_sendToSocket
extern "C"
sal_Int32 osl_sendToSocket(
oslSocket Socket,
oslSocketAddr ReceiverAddr,
const void * pBuffer,
sal_uInt32 BytesToSend,
oslSocketMsgFlag Flag );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Description
Tries to send one datagram with BytesToSend data to the given ReceiverAddr via the (implicitly unconnected) datagram-socket. Since there is only sent one packet, the function sends the data always complete even with incomplete packet boundaries.
Parameters
Socket
A bound or unbound socket. Socket will be bound
after a successful call.

ReceiverAddr
An initialized oslSocketAddress that contains
the destination address for this send.

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

osl_setAddrOfSocketAddr
extern "C"
oslSocketResult osl_setAddrOfSocketAddr(
oslSocketAddr Addr,
sal_Sequence * pByteSeq );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Sets the addr field in the struct sockaddr with pByteSeq. pByteSeq must be in network byte order.

osl_setInetPortOfSocketAddr
extern "C"
sal_Bool osl_setInetPortOfSocketAddr(
oslSocketAddr Addr,
sal_Int32 Port );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Sets the Port of Addr.
Parameters
Port
is expected in host byte-order.
Return
sal_False if Addr is not an inet-addr.

osl_setSocketOption
extern "C"
sal_Bool osl_setSocketOption(
oslSocket Socket,
oslSocketOptionLevel Level,
oslSocketOption Option,
void * pBuffer,
sal_uInt32 BufferLen );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Sets the sockets attributes.
Parameters
Socket
is the socket to modify.

    
Level
selects the level for which an option should be changed.
    Valid values are:
    
  • osl_sol_socket: Socket Level
  • osl_sol_tcp: Level of Transmission Control Protocol
Option
denotes the option to modify. See osl_setSocketOption() for more
    details.
    
    
pBuffer
Pointer to a Buffer which contains the attribute-value.

    
BufferSize
contains the length of the Buffer.

    
Return
True if the option could be changed.

osl_shutdownSocket
extern "C"
sal_Bool osl_shutdownSocket(
oslSocket Socket,
oslSocketDirection Direction );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Shuts down communication on a connected socket.
Parameters
Direction
denotes which end of the socket
should be closed:
  • osl_Socket_DirRead closes read operations.
  • osl_Socket_DirReadWrite closes write operations.
  • osl_Socket_DirWrite closes read and write operations.
Return
sal_True if the socket could be closed down.

osl_writeSocket
extern "C"
sal_Int32 osl_writeSocket(
oslSocket Socket,
const void * pBuffer,
sal_Int32 nSize );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO YES

Summary
Writes n bytes from pBuffer to the stream. The method avoids incomplete writes due to packet boundaries.
Parameters
pBuffer
contains the data to be written.
n
the number of bytes to write.
Return
the number of written bytes. The number will only be smaller than n if an exceptional condition (e.g. connection closed) occurs.

Top of Page

Apache Software Foundation

Copyright & License | Privacy | Website Feedback | Contact Us | Donate | Thanks

Apache, the Apache feather logo, and OpenOffice are trademarks of The Apache Software Foundation. OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.