## wxDatagramSocket

Derived from

wxSocketBase

Include files

<wx/socket.h>

Members

wxDatagramSocket::wxDatagramSocket
wxDatagramSocket::~wxDatagramSocket
wxDatagramSocket::ReceiveFrom
wxDatagramSocket::SendTo

### wxDatagramSocket::wxDatagramSocket

wxDatagramSocket(wxSocketFlags flags = wxSOCKET_NONE)

Constructor.

Parameters

flags

Socket flags (See wxSocketBase::SetFlags)

### wxDatagramSocket::~wxDatagramSocket

~wxDatagramSocket()

Destructor. Please see wxSocketBase::Destroy.

### wxDatagramSocket::ReceiveFrom

wxDatagramSocket& ReceiveFrom(wxSockAddress& address, void * buffer, wxUint32 nbytes)

This function reads a buffer of nbytes bytes from the socket.

Use LastCount to verify the number of bytes actually read.

Use Error to determine if the operation succeeded.

Parameters

address

Any address - will be overwritten with the address of the peer that sent that data.

buffer

Buffer where to put read data.

nbytes

Number of bytes.

Return value

Returns a reference to the current object, and the address of the peer that sent the data on address param.

See also

wxSocketBase::Error, wxSocketBase::LastError, wxSocketBase::LastCount, wxSocketBase::SetFlags,

### wxDatagramSocket::SendTo

wxDatagramSocket& SendTo(const wxSockAddress& address, const void * buffer, wxUint32 nbytes)

This function writes a buffer of nbytes bytes to the socket.

Use LastCount to verify the number of bytes actually wrote.

Use Error to determine if the operation succeeded.

Parameters

address

The address of the destination peer for this data.

buffer

Buffer where read data is.

nbytes

Number of bytes.

Return value

Returns a reference to the current object.

See also

wxSocketBase::Error, wxSocketBase::LastError, wxSocketBase::LastCount, wxSocketBase::SetFlags