/** Returns the address of the underlying socket in network byte order
*/ inline ::rtl::ByteSequence SAL_CALL getAddr(oslSocketResult *pResult = NULL) const;
/** assign the handle to this reference. The previous handle is released.
*/ inline SocketAddr & SAL_CALL operator= (oslSocketAddr Addr);
/** Assigns the socket addr without copyconstructing it. @paramAddrthesocketaddress. @paramnocopyuseSAL_NO_COPY
*/ inline SocketAddr & SAL_CALL assign( oslSocketAddr Addr, __osl_socket_NoCopy nocopy );
/** Returns true if the underlying handle is identical to the Addr handle.
*/ inlinebool SAL_CALL operator== (oslSocketAddr Addr) const;
/** Returns true if the underlying handle is identical to the Addr handle.
*/ inlinebool SAL_CALL operator== (const SocketAddr & Addr) const;
/** Returns the underlying SocketAddr handle without copyconstructing it.
*/ inline oslSocketAddr SAL_CALL getHandle() const;
/** Get the hostname for the local interface. @parampResultafterthecall*pResultcontainsosl_Socket_Okonsuccessor anerroronfailure. @returnthehostname
*/ staticinline ::rtl::OUString SAL_CALL getLocalHostname( oslSocketResult *pResult = NULL);
/** The instance takes over the handle's ownership without acquiring the handle,butreleasesitwithinthedtor. @paramsocketHandlethehandle @paramnoacquireuseSAL_NO_ACQUIRE
*/ inline Socket( oslSocket socketHandle, __sal_NoAcquire noacquire );
/** Destructor. Releases the underlying handle
*/ inline ~Socket();
/** Assignment operator. If socket was already created, the old one will bediscarded.
*/ inline Socket& SAL_CALL operator= ( oslSocket socketHandle);
/** Assignment operator. If socket was already created, the old one will bediscarded.
*/ inline Socket& SAL_CALL operator= (const Socket& sock);
/** Retrieves the address of the local interface of this socket. @paramAddr[out]receivestheaddress. @seeosl_getLocalAddrOfSocket()
*/ inlinevoid SAL_CALL getLocalAddr( SocketAddr &Addr ) const;
/** Get the local port of the socket. Usually used after bind(). @returntheportnumberorOSL_INVALID_PORTonerrors.
*/ inline sal_Int32 SAL_CALL getLocalPort() const;
/** Get the hostname for the local interface. @returnthehostnameoranemptystring("").
*/ inline ::rtl::OUString SAL_CALL getLocalHost() const;
/** Retrieves the address of the remote host of this socket. @paramAddr[out]receivestheaddress.
*/ inlinevoid SAL_CALL getPeerAddr( SocketAddr & Addr) const;
/** Get the remote port of the socket. @returntheportnumberorOSL_INVALID_PORTonerrors.
*/ inline sal_Int32 SAL_CALL getPeerPort() const;
/** Get the hostname for the remote interface. @returnthehostnameoranemptystring("").
*/ inline ::rtl::OUString SAL_CALL getPeerHost() const;
/** Binds the socket to the specified (local) interface. @paramLocalInterfaceAddressoftheInterface @returnTrueifbindwassuccessful.
*/ inlinebool SAL_CALL bind(const SocketAddr& LocalInterface);
/** Retrieves n bytes from the stream and copies them into pBuffer. Themethodavoidsincompletereadsduetopacketboundariesandisthus blocking. @parampBufferreceivesthereaddata.pBuffermustbelargeenough toholdnbytes. @paramnthenumberofbytestoread. @returnthenumberofreadbytes.Thenumberwillonlybesmallerthan nifanexceptionalcondition(e.g.connectionclosed)occurs.
*/ inline sal_Int32 SAL_CALL read(void* pBuffer, sal_uInt32 n);
/** Writes n bytes from pBuffer to the stream. The method avoids incompletewritesduetopacketboundariesandisthusblocking. @parampBuffercontainsthedatatobewritten. @paramnthenumberofbytestowrite. @returnthenumberofwrittenbytes.Thenumberwillonlybesmallerthan nifanexceptionalcondition(e.g.connectionclosed)occurs.
*/ inline sal_Int32 SAL_CALL write(constvoid* pBuffer, sal_uInt32 n);
/** Tries to receive BytesToRead data from the connected socket,
class ConnectorSocket : public StreamSocket
{ public: /** Creates a socket that can connect to a (remote) host. @paramFamilytheFamilyofthesocket(Inetbydefault) @paramProtocoltheProtoconofthesocket(IPbydefault) @paramTypeForsomeprotocolsitmightbedesirableto useadifferenttypethansock_stream<code>osl_Socket_TypeSeqPacket</code> (like<code>osl_Socket_TypeSeqPacket</code>). Thereforewedonothidethisparameterhere.
*/
ConnectorSocket(oslAddrFamily Family = osl_Socket_FamilyInet,
oslProtocol Protocol = osl_Socket_ProtocolIp,
oslSocketType Type = osl_Socket_TypeStream);
/** Connects the socket to a (remote) host. @paramTargetHostTheaddressofthetarget. @parampTimeoutThetimeoutforblocking.If0,adefaultsystemdependenttimeout usused. @return<code>osl_Socket_Ok</code>ifconnectedsuccessfully, <code>osl_Socket_TimedOut</code>ontimeout, <code>osl_Socket_Interrupted</code>ifunblockedforcefully(byosl::Socket::close()), <code>osl_Socket_Error</code>ifconnectfailed.
*/
oslSocketResult SAL_CALL connect(const SocketAddr& TargetHost, const TimeValue* pTimeout = NULL);
};
/** Allows to accept socket connections.
*/ class AcceptorSocket : public Socket
{ public: inline AcceptorSocket(oslAddrFamily Family = osl_Socket_FamilyInet,
oslProtocol Protocol = osl_Socket_ProtocolIp,
oslSocketType Type = osl_Socket_TypeStream);
/** Prepare a socket for the accept-call. The socket must have been boundbeforetothelocaladdress. @paramMaxPendingConnectionsThemaximumnumberofpending connections(waitingtobeaccepted)onthissocket.Ifyouuse -1,asystemdefaultvalueisused. @return<code>true</code>ifcallwassuccessful.
*/ inlinebool SAL_CALL listen(sal_Int32 MaxPendingConnections= -1);
/** Accepts incoming connections on the socket. You must precedethiscallwithosl::Socket::bind()andlisten(). @paramConnectionreceivestheincomingconnection. @return<code>osl_Socket_Ok</code>,ifaconnectionhasbeenaccepted, <code>osl_Socket_TimedOut</code>,ifm_RecvTimeoutmillisecondspassedwithoutconnect, <code>osl_Socket_Error</code>onerrors.
*/ inline oslSocketResult SAL_CALL acceptConnection( StreamSocket& Connection);
/** Accepts incoming connections on the socket. You must precedethiscallwithosl::Socket::bind()andlisten(). @paramPeerAddrreceivestheaddressoftheconnectingentity (yourcommunicationpartner). @paramConnectionreceivestheincomingconnection. @return<code>osl_Socket_Ok</code>,ifaconnectionhasbeenaccepted, <code>osl_Socket_TimedOut</code>,ifm_RecvTimeoutmillisecondspassedwithoutconnect, <code>osl_Socket_Error</code>onerrors.
*/ inline oslSocketResult SAL_CALL acceptConnection( StreamSocket& Connection, SocketAddr & PeerAddr);
};
/** A connectionless socket to send and receive datagrams.
*/ class DatagramSocket : public Socket
{ public:
/** Tries to send one datagram with BytesToSend size to the given ReceiverAddr. Sincethereisonlysendonepacket,thefunctiondoesn'tcareabout packetboundaries.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.