Main Page   Modules   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

OsclUDPSocket Class Reference
[OSCL IO]

#include <oscl_socket.h>

Inheritance diagram for OsclUDPSocket:

HeapBase _OsclHeapBase

Public Methods

OSCL_IMPORT_REF ~OsclUDPSocket ()
OSCL_IMPORT_REF int32 Close ()
OSCL_IMPORT_REF int32 Bind (OsclNetworkAddress &aAddress)
OSCL_IMPORT_REF int32 Join (OsclNetworkAddress &aAddress)
OSCL_IMPORT_REF TPVSocketEvent BindAsync (OsclNetworkAddress &aAddress, int32 aTimeoutMsec=(-1))
OSCL_IMPORT_REF void CancelBind ()
OSCL_IMPORT_REF uint8 * GetRecvData (int32 *aLength)
OSCL_IMPORT_REF uint8 * GetSendData (int32 *aLength)
OSCL_IMPORT_REF TPVSocketEvent SendTo (const uint8 *aPtr, uint32 aLen, OsclNetworkAddress &aAddress, int32 aTimeoutMsec=-1)
OSCL_IMPORT_REF void CancelSendTo ()
OSCL_IMPORT_REF TPVSocketEvent RecvFrom (uint8 *aPtr, uint32 aMaxLen, OsclNetworkAddress &aAddress, int32 aTimeoutMsec=-1, uint32 aMultiRecvLimit=0, Oscl_Vector< uint32, OsclMemAllocator > *aPacketLen=NULL, Oscl_Vector< OsclNetworkAddress, OsclMemAllocator > *aPacketSource=NULL)
OSCL_IMPORT_REF void CancelRecvFrom ()
OSCL_IMPORT_REF int32 SetRecvBufferSize (uint32 size)

Static Public Methods

OSCL_IMPORT_REF OsclUDPSocket * NewL (Oscl_DefAlloc &alloc, OsclSocketServ &aServ, OsclSocketObserver *aObserver, uint32 aId)

Detailed Description

The UDP Socket class


Constructor & Destructor Documentation

OSCL_IMPORT_REF OsclUDPSocket::~OsclUDPSocket  
 

Destructor. The object must be deleted using the same allocator used in the NewL call.


Member Function Documentation

OSCL_IMPORT_REF int32 OsclUDPSocket::Bind OsclNetworkAddress   aAddress
 

Bind a UDP socket to an address. This is a synchronous method.

Parameters:
aAddress:  Bind address.
Returns:
Returns OsclErrNone for success, or a platform-specific error code.

OSCL_IMPORT_REF TPVSocketEvent OsclUDPSocket::BindAsync OsclNetworkAddress   aAddress,
int32    aTimeoutMsec = (-1)
 

Bind a UDP socket to an address. This is an asynchronous method.

Parameters:
aAddress:  Bind address.
aTimeoutMsec:  Optional timeout. Use a negative value for infinite wait.
Returns:
Will return EPVSocketPending if successful. When the operation is complete, a callback to the observer will occur with the completion status. If the operation cannot be initiated, the call will return EPVSocketFailure and there will be no callback.

OSCL_IMPORT_REF void OsclUDPSocket::CancelBind  
 

Cancel Bind

This method will cancel any pending BindAsync operation on the current socket, causing the BindAsync to complete with error EPVSocketCancel. If there is no pending BindAsync operation, this method will have no effect.

OSCL_IMPORT_REF void OsclUDPSocket::CancelRecvFrom  
 

Cancel RecvFrom

This method will cancel any pending RecvFrom operation on the current socket, causing the RecvFrom to complete with error EPVSocketCancel. If there is no pending RecvFrom operation, this method will have no effect.

OSCL_IMPORT_REF void OsclUDPSocket::CancelSendTo  
 

Cancel SendTo

This method will cancel any pending SendTo operation on the current socket, causing the SendTo to complete with error EPVSocketCancel. If there is no pending SendTo operation, this method will have no effect.

OSCL_IMPORT_REF int32 OsclUDPSocket::Close  
 

Close a UDP socket. This is a synchronous method.

Once it is closed a socket cannot be re-opened. Sockets are automatically closed when they are deleted. This method may be used to see any error code returned from the platform's socket close call.

Returns:
Returns OsclErrNone for success, or a platform-specific error code.

OSCL_IMPORT_REF uint8* OsclUDPSocket::GetRecvData int32 *    aLength
 

Retrieve the received data after a successful RecvFrom operation. This is a synchronous method.

Parameters:
aLength:  (output) number of bytes of data received.
Returns:
Returns pointer to received data, or NULL if none.

OSCL_IMPORT_REF uint8* OsclUDPSocket::GetSendData int32 *    aLength
 

Retrieve the sent data after a successful SendTo operation. This is a synchronous method.

Parameters:
aLength:  (output) number of bytes of data sent.
Returns:
Returns pointer to sent data, or NULL if none.

OSCL_IMPORT_REF int32 OsclUDPSocket::Join OsclNetworkAddress   aAddress
 

Bind a UDP socket to an address and Join the multicast group. This is a synchronous method.

Parameters:
aAddress:  Bind address.
Returns:
Returns OsclErrNone for success, or a platform-specific error code. May throw an OsclErrNotSupported Exception

OSCL_IMPORT_REF OsclUDPSocket* OsclUDPSocket::NewL Oscl_DefAlloc   alloc,
OsclSocketServ   aServ,
OsclSocketObserver   aObserver,
uint32    aId
[static]
 

Create a UDP Socket. May leave if failure.

Parameters:
alloc:  Memory allocator.
aServ:  Socket server. Must be connected.
aObserver:  Socket observer.
aId:  Socket ID. The caller must assign an ID to each socket. The ID is used to identify the socket in observer callbacks.
Returns:
Returns pointer to socket.

OSCL_IMPORT_REF TPVSocketEvent OsclUDPSocket::RecvFrom uint8 *    aPtr,
uint32    aMaxLen,
OsclNetworkAddress   aAddress,
int32    aTimeoutMsec = -1,
uint32    aMultiRecvLimit = 0,
Oscl_Vector< uint32, OsclMemAllocator > *    aPacketLen = NULL,
Oscl_Vector< OsclNetworkAddress, OsclMemAllocator > *    aPacketSource = NULL
 

Receive Data. This is an asynchronous method.

Parameters:
aPtr:  Buffer to receive incoming data
aMaxLen:  Length of buffer.
aAddress:  (output) Source address.
aTimeoutMsec:  Timeout in milliseconds, or (-1) for infinite wait.
aMultiRecvLimit  (optional input): Configures multiple packet receive mode. As long as there are packets queued at the socket and at least aMultiRecvLimit bytes are available in the buffer, recvfrom operations will continue. A value of zero disabled multiple packet mode. The individual packet lengths can be retrieved in the aPacketLen parameter; and the individual packet source addresses can be retrieved in the aPacketSource parameter.
aPacketLen:  (optional output) a vector of packet lengths, in case multiple packets were received.
aPacketSource:  (optional output) a vector of source addresses, in case multiple packets were received.
Returns:
Will return EPVSocketPending if successful. When the operation is complete, a callback to the observer will occur with the completion status. If the operation cannot be initiated, the call will return EPVSocketFailure and there will be no callback.

OSCL_IMPORT_REF TPVSocketEvent OsclUDPSocket::SendTo const uint8 *    aPtr,
uint32    aLen,
OsclNetworkAddress   aAddress,
int32    aTimeoutMsec = -1
 

Send Data. This is an asynchronous method.

Parameters:
aPtr:  Data to send.
aLen:  Length of data to send.
aAddress:  Destination address.
aTimeoutMsec:  Timeout in milliseconds, or (-1) for infinite wait.
Returns:
Will return EPVSocketPending if successful. When the operation is complete, a callback to the observer will occur with the completion status. If the operation cannot be initiated, the call will return EPVSocketFailure and there will be no callback.

OSCL_IMPORT_REF int32 OsclUDPSocket::SetRecvBufferSize uint32    size
 

Set the buffer size of the socket This is a synchronous method.

Parameters:
size:  buffer size
Returns:
Returns OsclErrNone for success, or a platform-specific error code. May throw an OsclErrNotSupported Exception.


The documentation for this class was generated from the following file:
OSCL API
Posting Version: OPENCORE_20090310