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 INCLUDED_OSL_SOCKET_DECL_HXX
21 #define INCLUDED_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)
52 @param nocopy use SAL_NO_COPY
54 inline SocketAddr(const oslSocketAddr Addr
, __osl_socket_NoCopy nocopy
);
56 /** Copyconstructs the oslSocketAddr handle.
58 inline SocketAddr(oslSocketAddr Addr
);
60 /** tcpip-specific constructor.
61 @param strAddrOrHostName strAddrOrHostName hostname or dotted ip-number of the network
62 interface, the socket shall be created on.
63 @param nPort tcp-ip port number
65 inline SocketAddr( const ::rtl::OUString
& strAddrOrHostName
, sal_Int32 nPort
);
67 /** destroys underlying oslSocketAddress
71 /** checks, if the SocketAddr was created successful.
72 @return <code>true</code> if there is a valid underlying handle,
75 inline bool is() const;
77 /** Converts the address to a (human readable) domain-name.
79 @param pResult 0, if you are not interested in errors,
80 otherwise *pResult contains an error code on failure
81 or osl_Socket_Ok on success
82 @return the hostname of this SocketAddr or an empty string on failure.
83 @see osl_getHostnameOfSocketAddr()
85 inline ::rtl::OUString SAL_CALL
getHostname( oslSocketResult
*pResult
= 0 ) const;
87 /** Sets the ipaddress or hostname of the SocketAddress
89 inline bool SAL_CALL
setHostname( const ::rtl::OUString
&sDottedIpOrHostname
);
91 /** Returns the port number of the address.
92 @return the port in host-byte order or OSL_INVALID_PORT on errors.
94 inline sal_Int32 SAL_CALL
getPort() const;
96 /** Sets the port number of the address.
97 @return true if successfule.
99 inline bool SAL_CALL
setPort( sal_Int32 nPort
);
101 /** Sets the address of the underlying socket address struct in network byte order.
102 @return true on success, false signales falure.
104 inline bool SAL_CALL
setAddr( const ::rtl::ByteSequence
& address
);
106 /** Returns the address of the underlying socket in network byte order
108 inline ::rtl::ByteSequence SAL_CALL
getAddr( oslSocketResult
*pResult
= 0 ) const;
110 /** assign the handle to this reference. The previous handle is released.
112 inline SocketAddr
& SAL_CALL
operator= (oslSocketAddr Addr
);
116 inline SocketAddr
& SAL_CALL
operator= (const SocketAddr
& Addr
);
118 /** Assigns the socket addr without copyconstructing it.
119 @param Addr the socket address.
120 @param nocopy use SAL_NO_COPY
122 inline SocketAddr
& SAL_CALL
assign( oslSocketAddr Addr
, __osl_socket_NoCopy nocopy
);
124 /** Returns true if the underlying handle is identical to the Addr handle.
126 inline bool SAL_CALL
operator== (oslSocketAddr Addr
) const;
128 /** Returns true if the underlying handle is identical to the Addr handle.
130 inline bool SAL_CALL
operator== (const SocketAddr
& Addr
) const;
132 /** Returns the underlying SocketAddr handle without copyconstructing it.
134 inline oslSocketAddr SAL_CALL
getHandle() const;
136 /** Get the hostname for the local interface.
137 @param pResult after the call *pResult contains osl_Socket_Ok on success or
141 static inline ::rtl::OUString SAL_CALL
getLocalHostname( oslSocketResult
*pResult
= 0);
143 /** Tries to find an address for a host.
144 @see osl_resolveHostname()
145 @return A new created socket-address or 0 if the name could not be found.
147 static inline void SAL_CALL
resolveHostname(
148 const ::rtl::OUString
& strHostName
, SocketAddr
& Addr
);
151 Tries to find the port associated with the given service/protocol-
152 pair (e.g. "ftp"/"tcp").
153 @return the port number in host-byte order or <code>OSL_INVALID_PORT</code>
154 if no service/protocol pair could be found.
156 static inline sal_Int32 SAL_CALL
getServicePort(
157 const ::rtl::OUString
& strServiceName
,
158 const ::rtl::OUString
& strProtocolName
= ::rtl::OUString("tcp") );
167 /** Creates a socket. Note it's protected.
172 inline Socket(oslSocketType Type
,
173 oslAddrFamily Family
= osl_Socket_FamilyInet
,
174 oslProtocol Protocol
= osl_Socket_ProtocolIp
);
178 inline Socket( const Socket
& socket
);
180 inline Socket( oslSocket socketHandle
);
182 /** The instance takes over the handle's ownership without acquiring the
183 handle, but releases it within the dtor.
184 @param socketHandle the handle
185 @param noacquire use SAL_NO_ACQUIRE
187 inline Socket( oslSocket socketHandle
, __sal_NoAcquire noacquire
);
189 /** Destructor. Releases the underlying handle
193 /** Assignment operator. If socket was already created, the old one will
196 inline Socket
& SAL_CALL
operator= ( oslSocket socketHandle
);
198 /** Assignment operator. If socket was already created, the old one will
201 inline Socket
& SAL_CALL
operator= (const Socket
& sock
);
204 @return <code>true</code>, when the underlying handle of both
205 Socket instances are identical, <code>false</code> otherwise.
207 inline bool SAL_CALL
operator==( const Socket
& rSocket
) const ;
210 @return <code>true</code>, when the underlying handle of both
211 Socket instances are identical, <code>false</code> otherwise.
213 inline bool SAL_CALL
operator==( const oslSocket socketHandle
) const;
215 /** Closes a definite or both directions of the bidirectional stream.
218 @see osl_shutdownSocket()
220 inline void SAL_CALL
shutdown( oslSocketDirection Direction
= osl_Socket_DirReadWrite
);
223 Note that closing a socket is identical to shutdown( osl_Socket_DirReadWrite ),
224 as the operating system distinguish both cases, both functions or offered in this API.
225 @see osl_closeSocket()
227 inline void SAL_CALL
close();
229 /** Retrieves the address of the local interface of this socket.
230 @param Addr [out] receives the address.
231 @see osl_getLocalAddrOfSocket()
233 inline void SAL_CALL
getLocalAddr( SocketAddr
&Addr
) const;
235 /** Get the local port of the socket. Usually used after bind().
236 @return the port number or OSL_INVALID_PORT on errors.
238 inline sal_Int32 SAL_CALL
getLocalPort() const;
240 /** Get the hostname for the local interface.
241 @return the hostname or an empty string ("").
243 inline ::rtl::OUString SAL_CALL
getLocalHost() const;
245 /** Retrieves the address of the remote host of this socket.
246 @param Addr [out] receives the address.
248 inline void SAL_CALL
getPeerAddr( SocketAddr
& Addr
) const;
250 /** Get the remote port of the socket.
251 @return the port number or OSL_INVALID_PORT on errors.
253 inline sal_Int32 SAL_CALL
getPeerPort() const;
255 /** Get the hostname for the remote interface.
256 @return the hostname or an empty string ("").
258 inline ::rtl::OUString SAL_CALL
getPeerHost() const;
260 /** Binds the socket to the specified (local) interface.
261 @param LocalInterface Address of the Interface
262 @return True if bind was successful.
264 inline bool SAL_CALL
bind(const SocketAddr
& LocalInterface
);
266 /** Checks if read operations will block.
268 You can specify a timeout-value in seconds/nanoseconds that denotes
269 how the operation will block if the Socket is not ready.
270 @return <code>true</code> if read operations (recv, recvFrom, accept) on the Socket
271 will NOT block; <code>false</code> if it would block or if an error occurred.
273 @param pTimeout if 0, the operation will block without a timeout. Otherwise
274 the specified amout of time.
276 inline bool SAL_CALL
isRecvReady(const TimeValue
*pTimeout
= 0) const;
278 /** Checks if send operations will block.
280 You can specify a timeout-value in seconds/nanoseconds that denotes
281 how the operation will block if the Socket is not ready.
282 @return <code>true</code> if send operations (send, sendTo) on the Socket
283 will NOT block; <code>false</code> if it would block or if an error occurred.
285 @param pTimeout if 0, the operation will block without a timeout. Otherwise
286 the specified amout of time.
288 inline bool SAL_CALL
isSendReady(const TimeValue
*pTimeout
= 0) const;
291 /** Checks if a request for out-of-band data will block.
293 You can specify a timeout-value in seconds/nanoseconds that denotes
294 how the operation will block if the Socket has no pending OOB data.
296 @return <code>true</code> if OOB-request operations (recv with appropriate flags)
297 on the Socket will NOT block; <code>false</code> if it would block or if
300 @param pTimeout if 0, the operation will block without a timeout. Otherwise
301 the specified amout of time.
303 inline bool SAL_CALL
isExceptionPending(const TimeValue
*pTimeout
= 0) const;
306 /** Queries the socket for its type.
309 <li> <code>osl_Socket_TypeStream</code>
310 <li> <code>osl_Socket_TypeDgram</code>
311 <li> <code>osl_Socket_TypeRaw</code>
312 <li> <code>osl_Socket_TypeRdm</code>
313 <li> <code>osl_Socket_TypeSeqPacket</code>
314 <li> <code>osl_invalid_SocketType</code>, if an error occurred
317 inline oslSocketType SAL_CALL
getType() const;
319 /** Retrieves option-attributes associated with the socket.
320 @param Option The attribute to query.
321 Valid values (depending on the Level) are:
323 <li> <code>osl_Socket_Option_Debug</code><br>
324 (sal_Bool) Socket debug flag 1 = enabled, 0 = disabled.
326 <li> <code>osl_Socket_OptionAcceptConn</code><br>
327 <li> <code>osl_Socket_OptionReuseAddr</code><br>
328 (sal_Bool) Allows the socket to be bound to an address that is
330 1 = multiple bound allowed, 0 = no multiple bounds allowed
332 <li><code>osl_Socket_OptionKeepAlive</code><br>
333 (sal_Bool) Keepalive packets are sent by the underlying socket.
334 1 = enabled, 0 = disabled
336 <li><code>osl_Socket_OptionDontRoute</code><br>
337 (sal_Bool) Do not route: send directly to interface.
338 1 = do not route , 0 = routing possible
340 <li><code>osl_Socket_OptionBroadcast</code><br>
341 (sal_Bool) Transmission of broadcast messages are allowed on the socket.
342 1 = transmission allowed, 0 = transmission disallowed
344 <li><code>osl_Socket_OptionUseLoopback</code><br>
346 <li><code>osl_Socket_OptionLinger</code><br>
347 (linger) Linger on close if unsent data is present.
348 linger has two members: l_onoff, l_linger
349 l_onoff = 0 is off, l_onoff > 0 and l_linger= timeout in seconds.
351 <li><code>osl_Socket_OptionOOBinLine</code><br>
354 <li><code>osl_Socket_OptionSndBuf</code><br>
355 (sal_Int32) Size of the send buffer in bytes. Data is sent after
356 SndTimeo or when the buffer is full. This allows faster writing
359 <li><code>osl_Socket_OptionRcvBuf</code><br>
360 (sal_Int32) Size of the receive buffer in bytes. Data is sent after
361 SndTimeo or when the buffer is full. This allows faster writing
362 to the socket and larger packet sizes.
364 <li><code>osl_Socket_OptionSndLowat</code><br>
366 <li><code>osl_Socket_OptionRcvLowat</code><br>
368 <li><code>osl_Socket_OptionSndTimeo</code><br>
369 (sal_Int32) Data is sent after this timeout. This allows gathering
370 of data to send larger packages but increases latency times.
372 <li><code>osl_Socket_OptionRcvTimeo</code><br>
374 <li><code>osl_Socket_OptionError</code><br>
375 <li><code>osl_Socket_OptionType</code><br>
377 <li><code>osl_Socket_OptionTcpNoDelay</code><br>
378 Disables the Nagle algorithm for send coalescing. (Do not
379 collect data until a packet is full, instead send immediately.
380 This increases network traffic but might improve latency-times.)
381 1 = disables the algorithm, 0 = keeps it enabled.
384 If not above mentioned otherwise, the options are only valid for
385 level <code>osl_Socket_LevelSocket</code>.
386 @param pBuffer The Buffer will be filled with the attribute.
388 @param BufferLen The size of pBuffer.
390 @param Level The option level.
394 <li><code>osl_Socket_LevelSocket</code> : Socket Level
395 <li><code>osl_Socket_LevelTcp</code> : Level of Transmission Control Protocol
397 @return The size of the attribute copied into pBuffer or -1 if an error
400 inline sal_Int32 SAL_CALL
getOption(
401 oslSocketOption Option
,
403 sal_uInt32 BufferLen
,
404 oslSocketOptionLevel Level
= osl_Socket_LevelSocket
) const;
406 /** Sets the sockets attributes.
408 @param Option denotes the option to modify.
409 Valid values (depending on the Level) are:
411 <li> osl_Socket_Option_Debug
412 <li> osl_Socket_OptionAcceptConn
413 <li> osl_Socket_OptionReuseAddr
414 <li> osl_Socket_OptionKeepAlive
415 <li> osl_Socket_OptionDontRoute
416 <li> osl_Socket_OptionBroadcast
417 <li> osl_Socket_OptionUseLoopback
418 <li> osl_Socket_OptionLinger
419 <li> osl_Socket_OptionOOBinLine
420 <li> osl_Socket_OptionSndBuf
421 <li> osl_Socket_OptionRcvBuf
422 <li> osl_Socket_OptionSndLowat
423 <li> osl_Socket_OptionRcvLowat
424 <li> osl_Socket_OptionSndTimeo
425 <li> osl_Socket_OptionRcvTimeo
426 <li> osl_Socket_OptionError
427 <li> osl_Socket_OptionType
428 <li> osl_Socket_OptionTcpNoDelay
431 If not above mentioned otherwise, the options are only valid for
432 level osl_Socket_LevelSocket.
434 @param pBuffer Pointer to a Buffer which contains the attribute-value.
436 @param BufferLen contains the length of the Buffer.
438 @param Level selects the level for which an option should be changed.
441 <li> osl_Socket_evel_Socket : Socket Level
442 <li> osl_Socket_Level_Tcp : Level of Transmission Control Protocol
445 @return True if the option could be changed.
447 inline bool SAL_CALL
setOption( oslSocketOption Option
,
449 sal_uInt32 BufferLen
,
450 oslSocketOptionLevel Level
= osl_Socket_LevelSocket
) const;
452 /** Convenience function for setting sal_Bool and sal_Int32 option values.
455 inline bool setOption( oslSocketOption option
, sal_Int32 nValue
);
457 /** Convenience function for retrieving sal_Bool and sal_Int32 option values.
460 inline sal_Int32
getOption( oslSocketOption option
) const;
462 /** Enables/disables non-blocking mode of the socket.
463 @param bNonBlockingMode If <code>true</code>, blocking mode will be switched off
464 If <code>false</code>, the socket will become a blocking
465 socket (which is the default behaviour of a socket).
466 @return <code>true</code> if mode could be set.
468 inline bool SAL_CALL
enableNonBlockingMode( bool bNonBlockingMode
);
470 /** Query blocking mode of the socket.
471 @return <code>true</code> if non-blocking mode is set.
473 inline bool SAL_CALL
isNonBlockingMode() const;
476 /** clears the error status
478 inline void SAL_CALL
clearError() const;
480 /** returns a constant describing the last error for the socket system.
482 @return osl_Socket_E_NONE if no error occurred, invalid_SocketError if
483 an unknown (unmapped) error occurred, otherwise an enum describing the
485 @see osl_getLastSocketError()
487 inline oslSocketError
getError() const;
489 /** Builds a string with the last error-message for the socket.
491 inline ::rtl::OUString
getErrorAsString( ) const;
493 /** Returns the underlying handle unacquired (The caller must acquire it to keep it).
495 inline oslSocket
getHandle() const;
499 class StreamSocket
: public Socket
502 /** Creates a socket.
503 @param Family the Family of the socket (Inet by default)
504 @param Protocol the Protocon of the socket (IP by default)
505 @param Type For some protocols it might be desirable to
506 use a different type than <code>osl_Socket_TypeStream</code>
507 (like <code>osl_Socket_TypeSeqPacket</code>).
508 Therefore this parameter is not hidden.
510 inline StreamSocket(oslAddrFamily Family
= osl_Socket_FamilyInet
,
511 oslProtocol Protocol
= osl_Socket_ProtocolIp
,
512 oslSocketType Type
= osl_Socket_TypeStream
);
514 inline StreamSocket( const StreamSocket
& );
516 inline StreamSocket( oslSocket Socket
, __sal_NoAcquire noacquire
);
518 inline StreamSocket( oslSocket Socket
);
520 /** Retrieves n bytes from the stream and copies them into pBuffer.
521 The method avoids incomplete reads due to packet boundaries and is thus
523 @param pBuffer receives the read data. pBuffer must be large enough
525 @param n the number of bytes to read.
526 @return the number of read bytes. The number will only be smaller than
527 n if an exceptional condition (e.g. connection closed) occurs.
529 inline sal_Int32 SAL_CALL
read(void* pBuffer
, sal_uInt32 n
);
531 /** Writes n bytes from pBuffer to the stream. The method avoids
532 incomplete writes due to packet boundaries and is thus blocking.
533 @param pBuffer contains the data to be written.
534 @param n the number of bytes to write.
535 @return the number of written bytes. The number will only be smaller than
536 n if an exceptional condition (e.g. connection closed) occurs.
538 inline sal_Int32 SAL_CALL
write(const void* pBuffer
, sal_uInt32 n
);
541 /** Tries to receive BytesToRead data from the connected socket,
543 @param[out] pBuffer Points to a buffer that will be filled with the received
544 data. pBuffer must have at least have a size of BytesToRead.
545 @param[in] BytesToRead The number of bytes to read.
546 @param[in] flags Modifier for the call. Valid values are:
549 <li><code>osl_Socket_MsgNormal</code>
550 <li><code>osl_Socket_MsgOOB</code>
551 <li><code>osl_Socket_MsgPeek</code>
552 <li><code>osl_Socket_MsgDontRoute</code>
553 <li><code>osl_Socket_MsgMaxIOVLen</code>
555 @return the number of received bytes, which may be less than BytesToRead.
557 inline sal_Int32 SAL_CALL
recv(void* pBuffer
,
558 sal_uInt32 BytesToRead
,
559 oslSocketMsgFlag flags
= osl_Socket_MsgNormal
);
561 /** Tries to send BytesToSend data to the connected socket.
563 @param pBuffer [in] Points to a buffer that contains the send-data.
564 @param BytesToSend [in] The number of bytes to send. pBuffer must have at least
566 @param Flag [in] Modifier for the call. Valid values are:
568 <li><code>osl_Socket_MsgNormal</code>
569 <li><code>osl_Socket_MsgOOB</code>
570 <li><code>osl_Socket_MsgPeek</code>
571 <li><code>osl_Socket_MsgDontRoute</code>
572 <li><code>osl_Socket_MsgMaxIOVLen</code>
575 @return the number of transferred bytes. It may be less than BytesToSend.
577 sal_Int32 SAL_CALL
send(const void* pBuffer
,
578 sal_uInt32 BytesToSend
,
579 oslSocketMsgFlag
= osl_Socket_MsgNormal
);
582 class ConnectorSocket
: public StreamSocket
585 /** Creates a socket that can connect to a (remote) host.
586 @param Family the Family of the socket (Inet by default)
587 @param Protocol the Protocon of the socket (IP by default)
588 @param Type For some protocols it might be desirable to
589 use a different type than sock_stream <code>osl_Socket_TypeSeqPacket</code>
590 (like <code>osl_Socket_TypeSeqPacket</code>).
591 Therefore we do not hide this parameter here.
593 ConnectorSocket(oslAddrFamily Family
= osl_Socket_FamilyInet
,
594 oslProtocol Protocol
= osl_Socket_ProtocolIp
,
595 oslSocketType Type
= osl_Socket_TypeStream
);
598 /** Connects the socket to a (remote) host.
599 @param TargetHost The address of the target.
600 @param pTimeout The timeout for blocking. If 0, a default system dependent timeout
602 @return <code> osl_Socket_Ok</code> if connected successfully,
603 <code>osl_Socket_TimedOut</code> on timeout,
604 <code>osl_Socket_Interrupted</code> if unblocked forcefully (by osl::Socket::close()),
605 <code>osl_Socket_Error</code> if connect failed.
607 oslSocketResult SAL_CALL
connect(const SocketAddr
& TargetHost
, const TimeValue
* pTimeout
= 0);
610 /** Allows to accept socket connections.
612 class AcceptorSocket
: public Socket
615 inline AcceptorSocket(oslAddrFamily Family
= osl_Socket_FamilyInet
,
616 oslProtocol Protocol
= osl_Socket_ProtocolIp
,
617 oslSocketType Type
= osl_Socket_TypeStream
);
619 /** Prepare a socket for the accept-call. The socket must have been
620 bound before to the local address.
621 @param MaxPendingConnections The maximum number of pending
622 connections (waiting to be accepted) on this socket. If you use
623 -1, a system default value is used.
624 @return <code>true</code> if call was successful.
626 inline bool SAL_CALL
listen(sal_Int32 MaxPendingConnections
= -1);
628 /** Accepts incoming connections on the socket. You must
629 precede this call with osl::Socket::bind() and listen().
630 @param Connection receives the incoming connection.
631 @return <code>osl_Socket_Ok</code>, if a connection has been accepted,
632 <code>osl_Socket_TimedOut</code>, if m_RecvTimeout milliseconds passed without connect,
633 <code>osl_Socket_Error</code> on errors.
635 inline oslSocketResult SAL_CALL
acceptConnection( StreamSocket
& Connection
);
637 /** Accepts incoming connections on the socket. You must
638 precede this call with osl::Socket::bind() and listen().
639 @param PeerAddr receives the address of the connecting entity
640 (your communication partner).
641 @param Connection receives the incoming connection.
642 @return <code>osl_Socket_Ok</code>, if a connection has been accepted,
643 <code>osl_Socket_TimedOut</code>, if m_RecvTimeout milliseconds passed without connect,
644 <code>osl_Socket_Error</code> on errors.
646 inline oslSocketResult SAL_CALL
acceptConnection( StreamSocket
& Connection
, SocketAddr
& PeerAddr
);
651 /** A connectionless socket to send and receive datagrams.
653 class DatagramSocket
: public Socket
657 /** Creates a datagram socket.
658 @param Family the Family of the socket (Inet by default)
659 @param Protocol the Protocon of the socket (IP by default)
660 @param Type is sock_dgram by default.
662 inline DatagramSocket(oslAddrFamily Family
= osl_Socket_FamilyInet
,
663 oslProtocol Protocol
= osl_Socket_ProtocolIp
,
664 oslSocketType Type
= osl_Socket_TypeDgram
);
666 /** Tries to receives BufferSize data from the socket, if no error occurs.
668 @param pSenderAddr [out] You must provide pointer to a SocketAddr.
669 It will be filled with the address of the datagrams sender.
670 If pSenderAddr is 0, it is ignored.
671 @param pBuffer [out] Points to a buffer that will be filled with the received
673 @param BufferSize [in] The size of pBuffer.
674 @param Flag [in] Modifier for the call. Valid values are:
676 <li><code>osl_Socket_MsgNormal</code>
677 <li><code>osl_Socket_MsgOOB</code>
678 <li><code>osl_Socket_MsgPeek</code>
679 <li><code>osl_Socket_MsgDontRoute</code>
680 <li><code>osl_Socket_MsgMaxIOVLen</code>
683 @return the number of received bytes.
685 inline sal_Int32 SAL_CALL
recvFrom(void* pBuffer
,
686 sal_uInt32 BufferSize
,
687 SocketAddr
* pSenderAddr
= 0,
688 oslSocketMsgFlag Flag
= osl_Socket_MsgNormal
);
690 /** Tries to send one datagram with BytesToSend size to the given ReceiverAddr.
691 Since there is only send one packet, the function doesn't care about
694 @param ReceiverAddr [in] A SocketAddr that contains
695 the destination address for this send.
697 @param pBuffer [in] Points to a buffer that contains the send-data.
698 @param BufferSize [in] The number of bytes to send. pBuffer must have at least
700 @param Flag [in] Modifier for the call. Valid values are:
703 <li><code>osl_Socket_MsgNormal</code>
704 <li><code>osl_Socket_MsgOOB</code>
705 <li><code>osl_Socket_MsgPeek</code>
706 <li><code>osl_Socket_MsgDontRoute</code>
707 <li><code>osl_Socket_MsgMaxIOVLen</code>
710 @return the number of transferred bytes.
712 inline sal_Int32 SAL_CALL
sendTo( const SocketAddr
& ReceiverAddr
,
714 sal_uInt32 BufferSize
,
715 oslSocketMsgFlag Flag
= osl_Socket_MsgNormal
);
722 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */