Overview | Namespace | Class | Index | Help

## Methods of Class DatagramSocket

DatagramSocket
  DatagramSocket(

    oslAddrFamily | Family = osl_Socket_FamilyInet,
    oslProtocol | Protocol = osl_Socket_ProtocolIp,
    oslSocketType | Type = osl_Socket_TypeDgram );

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

  Summary
    Creates a datagram socket.
  Parameters

    Type |
        is sock_dgram by default.

recvFrom
  sal_Int32 recvFrom(

    void * | pBuffer,
    sal_uInt32 | BufferSize,
    SocketAddr * | pSenderAddr = 0,
    oslSocketMsgFlag | Flag = osl_Socket_MsgNormal );

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

  Summary
    Tries to receives BufferSize data from the socket, if no error occurs.
  Parameters

    pSenderAddr |
        You must provide pointer to a SocketAddr.
        It will be    filled with the address of the datagrams sender.
        If pSenderAddr 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.

sendTo
  sal_Int32 sendTo(

    const SocketAddr & | ReceiverAddr,
    const void * | pBuffer,
    sal_uInt32 | BufferSize,
    oslSocketMsgFlag | Flag = osl_Socket_MsgNormal );

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

  Description
    Tries to send one datagram with BytesToSend size to the given ReceiverAddr. Since there is only send one packet, the function doesn't care about packet boundaries.
  Parameters

    ReceiverAddr |
        A SocketAddr that contains
        the destination address for this send.
    pBuffer |
        Points to a buffer that contains the send-data.
    BufferSize |
        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.

Top of Page

Copyright © 2003 Sun Microsystems, Inc.