1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _OSL_SOCKET_DECL_HXX_
21 #define _OSL_SOCKET_DECL_HXX_
23 #include <osl/socket.h>
24 #include <rtl/ustring.hxx>
25 #include <rtl/byteseq.hxx>
29 enum __osl_socket_NoCopy
{ SAL_NO_COPY
};
31 /** The class should be understood as a reference to a socket address handle ( struct sockaddr ).
33 The handle is mutable.
38 oslSocketAddr m_handle
;
41 /** Creates socket address of unknown type.
47 inline SocketAddr(const SocketAddr
& Addr
);
49 /** The SocketAddr takes over the responsibility of the handle ( which means,
50 that the handle gets destructed by the destructor of this reference)
51 @param nocopy use SAL_NO_COPY
53 inline SocketAddr(const oslSocketAddr
, __osl_socket_NoCopy nocopy
);
55 /** Copyconstructs the oslSocketAddr handle.
57 inline SocketAddr(oslSocketAddr Addr
);
59 /** tcpip-specif constructor.
60 @param strAddrOrHostName strAddrOrHostName hostname or dotted ip-number of the network
61 interface, the socket shall be created on.
62 @param nPort tcp-ip port number
64 inline SocketAddr( const ::rtl::OUString
& strAddrOrHostName
, sal_Int32 nPort
);
66 /** destroys underlying oslSocketAddress
70 /** checks, if the SocketAddr was created successful.
71 @return <code>sal_True</code> if there is a valid underlying handle,
74 inline sal_Bool
is() const;
76 /** Converts the address to a (human readable) domain-name.
78 @param pResult 0, if you are not interested in errors,
79 otherwise *pResult contains an error code on failure
80 or osl_Socket_Ok on success
81 @return the hostname of this SocketAddr or an empty string on failure.
82 @see osl_getHostnameOfSocketAddr()
84 inline ::rtl::OUString SAL_CALL
getHostname( oslSocketResult
*pResult
= 0 ) const;
86 /** Sets the ipaddress or hostname of the SocketAddress
88 inline sal_Bool SAL_CALL
setHostname( const ::rtl::OUString
&sDottedIpOrHostname
);
90 /** Returns the port number of the address.
91 @return the port in host-byte order or or OSL_INVALID_PORT on errors.
93 inline sal_Int32 SAL_CALL
getPort() const;
95 /** Sets the port number of the address.
96 @return true if successfule.
98 inline sal_Bool SAL_CALL
setPort( sal_Int32 nPort
);
100 /** Sets the address of the underlying socket address struct in network byte order.
101 @return true on success, false signales falure.
103 inline sal_Bool SAL_CALL
setAddr( const ::rtl::ByteSequence
& address
);
105 /** Returns the address of the underlying socket in network byte order
107 inline ::rtl::ByteSequence SAL_CALL
getAddr( oslSocketResult
*pResult
= 0 ) const;
109 /** assign the handle to this reference. The previous handle is released.
111 inline SocketAddr
& SAL_CALL
operator= (oslSocketAddr Addr
);
115 inline SocketAddr
& SAL_CALL
operator= (const SocketAddr
& Addr
);
117 /** Assigns the socket addr without copyconstructing it.
118 @param Addr the socket address.
119 @param nocopy use SAL_NO_COPY
121 inline SocketAddr
& SAL_CALL
assign( oslSocketAddr Addr
, __osl_socket_NoCopy nocopy
);
123 /** Returns true if the underlying handle is identical to the Addr handle.
125 inline sal_Bool SAL_CALL
operator== (oslSocketAddr Addr
) const;
127 /** Returns true if the underlying handle is identical to the Addr handle.
129 inline sal_Bool SAL_CALL
operator== (const SocketAddr
& Addr
) const;
131 /** Returns the underlying SocketAddr handle without copyconstructing it.
133 inline oslSocketAddr SAL_CALL
getHandle() const;
135 /** Get the hostname for the local interface.
136 @param pResult after the call *pResult contains osl_Socket_Ok on success or
140 static inline ::rtl::OUString SAL_CALL
getLocalHostname( oslSocketResult
*pResult
= 0);
142 /** Tries to find an address for a host.
143 @see osl_resolveHostname()
144 @return A new created socket-address or 0 if the name could not be found.
146 static inline void SAL_CALL
resolveHostname(
147 const ::rtl::OUString
& strHostName
, SocketAddr
& Addr
);
150 Tries to find the port associated with the given service/protocol-
151 pair (e.g. "ftp"/"tcp").
152 @return the port number in host-byte order or <code>OSL_INVALID_PORT</code>
153 if no service/protocol pair could be found.
155 static inline sal_Int32 SAL_CALL
getServicePort(
156 const ::rtl::OUString
& strServiceName
,
157 const ::rtl::OUString
& strProtocolName
= ::rtl::OUString("tcp") );
166 /** Creates a socket. Note it's protected.
171 inline Socket(oslSocketType Type
,
172 oslAddrFamily Family
= osl_Socket_FamilyInet
,
173 oslProtocol Protocol
= osl_Socket_ProtocolIp
);
177 inline Socket( const Socket
& socket
);
179 inline Socket( oslSocket socketHandle
);
181 /** The instance takes over the handle's ownership without acquiring the
182 handle, but releases it within the dtor.
183 @param socketHandle the handle
184 @param noacquire use SAL_NO_ACQUIRE
186 inline Socket( oslSocket socketHandle
, __sal_NoAcquire noacquire
);
188 /** Destructor. Releases the underlying handle
192 /** Assignment operator. If socket was already created, the old one will
195 inline Socket
& SAL_CALL
operator= ( oslSocket socketHandle
);
197 /** Assignment operator. If socket was already created, the old one will
200 inline Socket
& SAL_CALL
operator= (const Socket
& sock
);
203 @return <code>sal_True</code>, when the underlying handle of both
204 Socket instances are identical, <code>sal_False</code> otherwise.
206 inline sal_Bool SAL_CALL
operator==( const Socket
& rSocket
) const ;
209 @return <code>sal_True</code>, when the underlying handle of both
210 Socket instances are identical, <code>sal_False</code> otherwise.
212 inline sal_Bool SAL_CALL
operator==( const oslSocket socketHandle
) const;
214 /** Closes a definite or both directions of the bidirectional stream.
217 @see osl_shutdownSocket()
219 inline void SAL_CALL
shutdown( oslSocketDirection Direction
= osl_Socket_DirReadWrite
);
222 Note that closing a socket is identical to shutdown( osl_Socket_DirReadWrite ),
223 as the operating system distinguish both cases, both functions or offered in this API.
224 @see osl_closeSocket()
226 inline void SAL_CALL
close();
228 /** Retrieves the address of the local interface of this socket.
229 @param Addr [out] receives the address.
230 @see osl_getLocalAddrOfSocket()
232 inline void SAL_CALL
getLocalAddr( SocketAddr
&Addr
) const;
234 /** Get the local port of the socket. Usually used after bind().
235 @return the port number or OSL_INVALID_PORT on errors.
237 inline sal_Int32 SAL_CALL
getLocalPort() const;
239 /** Get the hostname for the local interface.
240 @return the hostname or an empty string ("").
242 inline ::rtl::OUString SAL_CALL
getLocalHost() const;
244 /** Retrieves the address of the remote host of this socket.
245 @param Addr [out] receives the address.
247 inline void SAL_CALL
getPeerAddr( SocketAddr
& Addr
) const;
249 /** Get the remote port of the socket.
250 @return the port number or OSL_INVALID_PORT on errors.
252 inline sal_Int32 SAL_CALL
getPeerPort() const;
254 /** Get the hostname for the remote interface.
255 @return the hostname or an empty string ("").
257 inline ::rtl::OUString SAL_CALL
getPeerHost() const;
259 /** Binds the socket to the specified (local) interface.
260 @param LocalInterface Address of the Interface
261 @return True if bind was successful.
263 inline sal_Bool SAL_CALL
bind(const SocketAddr
& LocalInterface
);
265 /** Checks if read operations will block.
267 You can specify a timeout-value in seconds/nanoseconds that denotes
268 how the operation will block if the Socket is not ready.
269 @return <code>sal_True</code> if read operations (recv, recvFrom, accept) on the Socket
270 will NOT block; <code>sal_False</code> if it would block or if an error occurred.
272 @param pTimeout if 0, the operation will block without a timeout. Otherwise
273 the specified amout of time.
275 inline sal_Bool SAL_CALL
isRecvReady(const TimeValue
*pTimeout
= 0) const;
277 /** Checks if send operations will block.
279 You can specify a timeout-value in seconds/nanoseconds that denotes
280 how the operation will block if the Socket is not ready.
281 @return <code>sal_True</code> if send operations (send, sendTo) on the Socket
282 will NOT block; <code>sal_False</code> if it would block or if an error occurred.
284 @param pTimeout if 0, the operation will block without a timeout. Otherwise
285 the specified amout of time.
287 inline sal_Bool SAL_CALL
isSendReady(const TimeValue
*pTimeout
= 0) const;
290 /** Checks if a request for out-of-band data will block.
292 You can specify a timeout-value in seconds/nanoseconds that denotes
293 how the operation will block if the Socket has no pending OOB data.
295 @return <code>sal_True</code> if OOB-request operations (recv with appropriate flags)
296 on the Socket will NOT block; <code>sal_False</code> if it would block or if
299 @param pTimeout if 0, the operation will block without a timeout. Otherwise
300 the specified amout of time.
302 inline sal_Bool SAL_CALL
isExceptionPending(const TimeValue
*pTimeout
= 0) const;
305 /** Queries the socket for its type.
308 <li> <code>osl_Socket_TypeStream</code>
309 <li> <code>osl_Socket_TypeDgram</code>
310 <li> <code>osl_Socket_TypeRaw</code>
311 <li> <code>osl_Socket_TypeRdm</code>
312 <li> <code>osl_Socket_TypeSeqPacket</code>
313 <li> <code>osl_invalid_SocketType</code>, if an error occurred
316 inline oslSocketType SAL_CALL
getType() const;
318 /** Retrieves option-attributes associated with the socket.
319 @param Option The attribute to query.
320 Valid values (depending on the Level) are:
322 <li> <code>osl_Socket_Option_Debug</code><br>
323 (sal_Bool) Socket debug flag 1 = enabled, 0 = disabled.
325 <li> <code>osl_Socket_OptionAcceptConn</code><br>
326 <li> <code>osl_Socket_OptionReuseAddr</code><br>
327 (sal_Bool) Allows the socket to be bound to an address that is
329 1 = multiple bound allowed, 0 = no multiple bounds allowed
331 <li><code>osl_Socket_OptionKeepAlive</code><br>
332 (sal_Bool) Keepalive packets are sent by the underlying socket.
333 1 = enabled, 0 = disabled
335 <li><code>osl_Socket_OptionDontRoute</code><br>
336 (sal_Bool) Do not route: send directly to interface.
337 1 = do not route , 0 = routing possible
339 <li><code>osl_Socket_OptionBroadcast</code><br>
340 (sal_Bool) Transmission of broadcast messages are allowed on the socket.
341 1 = transmission allowed, 0 = transmission disallowed
343 <li><code>osl_Socket_OptionUseLoopback</code><br>
345 <li><code>osl_Socket_OptionLinger</code><br>
346 (linger) Linger on close if unsent data is present.
347 linger has two members: l_onoff, l_linger
348 l_onoff = 0 is off, l_onoff > 0 and l_linger= timeout in seconds.
350 <li><code>osl_Socket_OptionOOBinLine</code><br>
353 <li><code>osl_Socket_OptionSndBuf</code><br>
354 (sal_Int32) Size of the send buffer in bytes. Data is sent after
355 SndTimeo or when the buffer is full. This allows faster writing
358 <li><code>osl_Socket_OptionRcvBuf</code><br>
359 (sal_Int32) Size of the receive buffer in bytes. Data is sent after
360 SndTimeo or when the buffer is full. This allows faster writing
361 to the socket and larger packet sizes.
363 <li><code>osl_Socket_OptionSndLowat</code><br>
365 <li><code>osl_Socket_OptionRcvLowat</code><br>
367 <li><code>osl_Socket_OptionSndTimeo</code><br>
368 (sal_Int32) Data is sent after this timeout. This allows gathering
369 of data to send larger packages but increases latency times.
371 <li><code>osl_Socket_OptionRcvTimeo</code><br>
373 <li><code>osl_Socket_OptionError</code><br>
374 <li><code>osl_Socket_OptionType</code><br>
376 <li><code>osl_Socket_OptionTcpNoDelay</code><br>
377 Disables the Nagle algorithm for send coalescing. (Do not
378 collect data until a packet is full, instead send immediately.
379 This increases network traffic but might improve latency-times.)
380 1 = disables the algorithm, 0 = keeps it enabled.
383 If not above mentioned otherwise, the options are only valid for
384 level <code>osl_Socket_LevelSocket</code>.
385 @param pBuffer The Buffer will be filled with the attribute.
387 @param BufferLen The size of pBuffer.
389 @param Level The option level.
393 <li><code>osl_Socket_LevelSocket</code> : Socket Level
394 <li><code>osl_Socket_LevelTcp</code> : Level of Transmission Control Protocol
396 @return The size of the attribute copied into pBuffer or -1 if an error
399 inline sal_Int32 SAL_CALL
getOption(
400 oslSocketOption Option
,
402 sal_uInt32 BufferLen
,
403 oslSocketOptionLevel Level
= osl_Socket_LevelSocket
) const;
405 /** Sets the sockets attributes.
407 @param Option denotes the option to modify.
408 Valid values (depending on the Level) are:
410 <li> osl_Socket_Option_Debug
411 <li> osl_Socket_OptionAcceptConn
412 <li> osl_Socket_OptionReuseAddr
413 <li> osl_Socket_OptionKeepAlive
414 <li> osl_Socket_OptionDontRoute
415 <li> osl_Socket_OptionBroadcast
416 <li> osl_Socket_OptionUseLoopback
417 <li> osl_Socket_OptionLinger
418 <li> osl_Socket_OptionOOBinLine
419 <li> osl_Socket_OptionSndBuf
420 <li> osl_Socket_OptionRcvBuf
421 <li> osl_Socket_OptionSndLowat
422 <li> osl_Socket_OptionRcvLowat
423 <li> osl_Socket_OptionSndTimeo
424 <li> osl_Socket_OptionRcvTimeo
425 <li> osl_Socket_OptionError
426 <li> osl_Socket_OptionType
427 <li> osl_Socket_OptionTcpNoDelay
430 If not above mentioned otherwise, the options are only valid for
431 level osl_Socket_LevelSocket.
433 @param pBuffer Pointer to a Buffer which contains the attribute-value.
435 @param BufferLen contains the length of the Buffer.
437 @param Level selects the level for which an option should be changed.
440 <li> osl_Socket_evel_Socket : Socket Level
441 <li> osl_Socket_Level_Tcp : Level of Transmission Control Protocol
444 @return True if the option could be changed.
446 inline sal_Bool SAL_CALL
setOption( oslSocketOption Option
,
448 sal_uInt32 BufferLen
,
449 oslSocketOptionLevel Level
= osl_Socket_LevelSocket
) const;
451 /** Convenience function for setting sal_Bool and sal_Int32 option values.
454 inline sal_Bool
setOption( oslSocketOption option
, sal_Int32 nValue
);
456 /** Convenience function for retrieving sal_Bool and sal_Int32 option values.
459 inline sal_Int32
getOption( oslSocketOption option
) const;
461 /** Enables/disables non-blocking mode of the socket.
462 @param bNonBlockingMode If <code>sal_True</code>, blocking mode will be switched off
463 If <code>sal_False</code>, the socket will become a blocking
464 socket (which is the default behaviour of a socket).
465 @return <code>sal_True</code> if mode could be set.
467 inline sal_Bool SAL_CALL
enableNonBlockingMode( sal_Bool bNonBlockingMode
);
469 /** Query blocking mode of the socket.
470 @return <code>sal_True</code> if non-blocking mode is set.
472 inline sal_Bool SAL_CALL
isNonBlockingMode() const;
475 /** clears the error status
477 inline void SAL_CALL
clearError() const;
479 /** returns a constant decribing the last error for the socket system.
481 @return osl_Socket_E_NONE if no error occurred, invalid_SocketError if
482 an unknown (unmapped) error occurred, otherwise an enum describing the
484 @see osl_getLastSocketError()
486 inline oslSocketError
getError() const;
488 /** Builds a string with the last error-message for the socket.
490 inline ::rtl::OUString
getErrorAsString( ) const;
492 /** Returns the underlying handle unacquired (The caller must acquire it to keep it).
494 inline oslSocket
getHandle() const;
498 class StreamSocket
: public Socket
501 /** Creates a socket.
502 @param Family the Family of the socket (Inet by default)
503 @param Protocol the Protocon of the socket (IP by default)
504 @param Type For some protocols it might be desirable to
505 use a different type than <code>osl_Socket_TypeStream</code>
506 (like <code>osl_Socket_TypeSeqPacket</code>).
507 Therefore this parameter is not hidden.
509 inline StreamSocket(oslAddrFamily Family
= osl_Socket_FamilyInet
,
510 oslProtocol Protocol
= osl_Socket_ProtocolIp
,
511 oslSocketType Type
= osl_Socket_TypeStream
);
513 inline StreamSocket( const StreamSocket
& );
515 inline StreamSocket( oslSocket Socket
, __sal_NoAcquire noacquire
);
517 inline StreamSocket( oslSocket Socket
);
519 /** Retrieves n bytes from the stream and copies them into pBuffer.
520 The method avoids incomplete reads due to packet boundaries and is thus
522 @param pBuffer receives the read data. pBuffer must be large enough
524 @param n the number of bytes to read.
525 @return the number of read bytes. The number will only be smaller than
526 n if an exceptional condition (e.g. connection closed) occurs.
528 inline sal_Int32 SAL_CALL
read(void* pBuffer
, sal_uInt32 n
);
530 /** Writes n bytes from pBuffer to the stream. The method avoids
531 incomplete writes due to packet boundaries and is thus blocking.
532 @param pBuffer contains the data to be written.
533 @param n the number of bytes to write.
534 @return the number of written bytes. The number will only be smaller than
535 n if an exceptional condition (e.g. connection closed) occurs.
537 inline sal_Int32 SAL_CALL
write(const void* pBuffer
, sal_uInt32 n
);
540 /** Tries to receive BytesToRead data from the connected socket,
542 @param[out] pBuffer Points to a buffer that will be filled with the received
543 data. pBuffer must have at least have a size of BytesToRead.
544 @param[in] BytesToRead The number of bytes to read.
545 @param[in] flags Modifier for the call. Valid values are:
548 <li><code>osl_Socket_MsgNormal</code>
549 <li><code>osl_Socket_MsgOOB</code>
550 <li><code>osl_Socket_MsgPeek</code>
551 <li><code>osl_Socket_MsgDontRoute</code>
552 <li><code>osl_Socket_MsgMaxIOVLen</code>
554 @return the number of received bytes, which may be less than BytesToRead.
556 inline sal_Int32 SAL_CALL
recv(void* pBuffer
,
557 sal_uInt32 BytesToRead
,
558 oslSocketMsgFlag flags
= osl_Socket_MsgNormal
);
560 /** Tries to send BytesToSend data to the connected socket.
562 @param pBuffer [in] Points to a buffer that contains the send-data.
563 @param BytesToSend [in] The number of bytes to send. pBuffer must have at least
565 @param Flag [in] Modifier for the call. Valid values are:
567 <li><code>osl_Socket_MsgNormal</code>
568 <li><code>osl_Socket_MsgOOB</code>
569 <li><code>osl_Socket_MsgPeek</code>
570 <li><code>osl_Socket_MsgDontRoute</code>
571 <li><code>osl_Socket_MsgMaxIOVLen</code>
574 @return the number of transfered bytes. It may be less than BytesToSend.
576 sal_Int32 SAL_CALL
send(const void* pBuffer
,
577 sal_uInt32 BytesToSend
,
578 oslSocketMsgFlag
= osl_Socket_MsgNormal
);
581 class ConnectorSocket
: public StreamSocket
584 /** Creates a socket that can connect to a (remote) host.
585 @param Family the Family of the socket (Inet by default)
586 @param Protocol the Protocon of the socket (IP by default)
587 @param Type For some protocols it might be desirable to
588 use a different type than sock_stream <code>osl_Socket_TypeSeqPacket</code>
589 (like <code>osl_Socket_TypeSeqPacket</code>).
590 Therefore we do not hide this parameter here.
592 ConnectorSocket(oslAddrFamily Family
= osl_Socket_FamilyInet
,
593 oslProtocol Protocol
= osl_Socket_ProtocolIp
,
594 oslSocketType Type
= osl_Socket_TypeStream
);
597 /** Connects the socket to a (remote) host.
598 @param TargetHost The address of the target.
599 @param pTimeout The timeout for blocking. If 0, a default system dependent timeout
601 @return <code> osl_Socket_Ok</code> if connected successfully,
602 <code>osl_Socket_TimedOut</code> on timeout,
603 <code>osl_Socket_Interrupted</code> if unblocked forcefully (by osl::Socket::close()),
604 <code>osl_Socket_Error</code> if connect failed.
606 oslSocketResult SAL_CALL
connect(const SocketAddr
& TargetHost
, const TimeValue
* pTimeout
= 0);
609 /** Allows to accept socket connections.
611 class AcceptorSocket
: public Socket
614 inline AcceptorSocket(oslAddrFamily Family
= osl_Socket_FamilyInet
,
615 oslProtocol Protocol
= osl_Socket_ProtocolIp
,
616 oslSocketType Type
= osl_Socket_TypeStream
);
618 /** Prepare a socket for the accept-call. The socket must have been
619 bound before to the local address.
620 @param MaxPendingConnections The maximum number of pending
621 connections (waiting to be accepted) on this socket. If you use
622 -1, a system default value is used.
623 @return <code>sal_True</code> if call was successful.
625 inline sal_Bool SAL_CALL
listen(sal_Int32 MaxPendingConnections
= -1);
627 /** Accepts incoming connections on the socket. You must
628 precede this call with osl::Socket::bind() and listen().
629 @param Connection receives the incoming connection.
630 @return <code>osl_Socket_Ok</code>, if a connection has been accepted,
631 <code>osl_Socket_TimedOut</code>, if m_RecvTimeout milliseconds passed without connect,
632 <code>osl_Socket_Error</code> on errors.
634 inline oslSocketResult SAL_CALL
acceptConnection( StreamSocket
& Connection
);
636 /** Accepts incoming connections on the socket. You must
637 precede this call with osl::Socket::bind() and listen().
638 @param PeerAddr receives the address of the connecting entity
639 (your communication partner).
640 @param Connection receives the incoming connection.
641 @return <code>osl_Socket_Ok</code>, if a connection has been accepted,
642 <code>osl_Socket_TimedOut</code>, if m_RecvTimeout milliseconds passed without connect,
643 <code>osl_Socket_Error</code> on errors.
645 inline oslSocketResult SAL_CALL
acceptConnection( StreamSocket
& Connection
, SocketAddr
& PeerAddr
);
650 /** A connectionless socket to send and receive datagrams.
652 class DatagramSocket
: public Socket
656 /** Creates a datagram socket.
657 @param Family the Family of the socket (Inet by default)
658 @param Protocol the Protocon of the socket (IP by default)
659 @param Type is sock_dgram by default.
661 inline DatagramSocket(oslAddrFamily Family
= osl_Socket_FamilyInet
,
662 oslProtocol Protocol
= osl_Socket_ProtocolIp
,
663 oslSocketType Type
= osl_Socket_TypeDgram
);
665 /** Tries to receives BufferSize data from the socket, if no error occurs.
667 @param pSenderAddr [out] You must provide pointer to a SocketAddr.
668 It will be filled with the address of the datagrams sender.
669 If pSenderAddr is 0, it is ignored.
670 @param pBuffer [out] Points to a buffer that will be filled with the received
672 @param BufferSize [in] The size of pBuffer.
673 @param Flag [in] Modifier for the call. Valid values are:
675 <li><code>osl_Socket_MsgNormal</code>
676 <li><code>osl_Socket_MsgOOB</code>
677 <li><code>osl_Socket_MsgPeek</code>
678 <li><code>osl_Socket_MsgDontRoute</code>
679 <li><code>osl_Socket_MsgMaxIOVLen</code>
682 @return the number of received bytes.
684 inline sal_Int32 SAL_CALL
recvFrom(void* pBuffer
,
685 sal_uInt32 BufferSize
,
686 SocketAddr
* pSenderAddr
= 0,
687 oslSocketMsgFlag Flag
= osl_Socket_MsgNormal
);
689 /** Tries to send one datagram with BytesToSend size to the given ReceiverAddr.
690 Since there is only send one packet, the function doesn't care about
693 @param ReceiverAddr [in] A SocketAddr that contains
694 the destination address for this send.
696 @param pBuffer [in] Points to a buffer that contains the send-data.
697 @param BufferSize [in] The number of bytes to send. pBuffer must have at least
699 @param Flag [in] Modifier for the call. Valid values are:
702 <li><code>osl_Socket_MsgNormal</code>
703 <li><code>osl_Socket_MsgOOB</code>
704 <li><code>osl_Socket_MsgPeek</code>
705 <li><code>osl_Socket_MsgDontRoute</code>
706 <li><code>osl_Socket_MsgMaxIOVLen</code>
709 @return the number of transfered bytes.
711 inline sal_Int32 SAL_CALL
sendTo( const SocketAddr
& ReceiverAddr
,
713 sal_uInt32 BufferSize
,
714 oslSocketMsgFlag Flag
= osl_Socket_MsgNormal
);
721 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */