UDPoint

Files CCore/inc/net/UDPoint.h CCore/src/net/UDPoint.cpp

UDPoint is the UDP address, i.e. IP address + UDP port.


struct UDPoint
 {
  IPAddress address;
  UDPort port;
  
  // constructors
  
  UDPoint() : address(),port() {}
  
  UDPoint(IPAddress address_,UDPort port_) : address(address_),port(port_) {}
  
  UDPoint(uint8 a1,uint8 a2,uint8 a3,uint8 a4,UDPort port_) : address(a1,a2,a3,a4),port(port_) {}
  
  explicit UDPoint(XPoint a);
  
  // methods
  
  friend bool operator == (UDPoint a,UDPoint b);
  
  friend bool operator != (UDPoint a,UDPoint b);
  
  XPoint get() const;
  
  // print object
  
  template <class P>
  void print(P &out) const;

  // scan object

  template <class S>
  void scan(S &inp);
 };

The method get() converts UDPoint to XPoint. The original UDPoint can be restored by the constructor with the XPoint argument.

This type is printable and scannable in the text form like 192.168.1.1:500.

There are several UDP port constants, defined in the header net/UDPoint.h.


const UDPort EchoUDPort       =     7 ;

const UDPort PTPServerUDPort  = 52000 ;

const UDPort PTPClientUDPort  = 52001 ;

const UDPort PKEClientUDPort  = 52100 ;

const UDPort PSecClientUDPort = 52101 ;

const UDPort PKEServerUDPort  = 52102 ;

const UDPort PSecServerUDPort = 52103 ;

EchoUDPort — the standard UDP echo port.

PTPServerUDPort — PTP over UDP server port. This is not a standard port.

PTPClientUDPort — PTP over UDP client port. This is not a standard port.

PKEClientUDPort — PKE over UDP client port. This is not a standard port.

PSecClientUDPort — PSec over UDP client port. This is not a standard port.

PKEServerUDPort — PKE over UDP server port. This is not a standard port.

PSecServerUDPort — PSec over UDP server port. This is not a standard port.


template <class Dev>
void ParseUDPoint(Dev &dev,UDPoint &ret);

The function ParseUDPoint() can be used to parse a UDPoint from a character stream.