Class UDPControlInfo

File: src/transport/contract/UDPControlInfo.msg

Control info for sending/receiving data via UDP. Travels between application and the UDP module.

The most convenient way to handle UDP is the UDPSocket class, which hides UDPControlInfo completely from you. But even if you manage talking to UDP yourself without help from UDPSocket, sockId must be obtained from UDPSocket::generateSocketId().

See also: UDPCommandCode

Usage diagram:

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram. Click here to see the full picture.

Inheritance diagram:

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram. Click here to see the full picture.

Fields:

Name Type Description
srcPort int

UDP source port in packet, or local port with BIND

sockId int

uniquely identifies the UDP socket

interfaceId int

interface on which pk was received/should be sent (see InterfaceTable)

userId int

id than can be freely used by the app

destAddr IPvXAddress

destination IP or IPv6 address

srcAddr IPvXAddress

source IP or IPv6 address, or local address with BIND

destPort int

UDP destination port in packet

Source code:

//
// Control info for sending/receiving data via \UDP. Travels between
// application and the UDP module.
//
// The most convenient way to handle UDP is the UDPSocket class, which hides
// UDPControlInfo completely from you. But even if you manage talking
// to UDP yourself without help from UDPSocket, sockId must be obtained
// from UDPSocket::generateSocketId().
//
//# TODO explain userId, sockId, etc.
//
// @see UDPCommandCode
//
class UDPControlInfo
{
    int sockId = -1;   // uniquely identifies the \UDP socket
    int userId = -1;   // id than can be freely used by the app
    IPvXAddress srcAddr;  // source \IP or \IPv6 address, or local address with BIND
    IPvXAddress destAddr; // destination \IP or \IPv6 address
    int srcPort;   // \UDP source port in packet, or local port with BIND
    int destPort;  // \UDP destination port in packet
    int interfaceId = -1; // interface on which pk was received/should be sent (see InterfaceTable)
}