ITCH 5.0 Market Data Handler 1.0.0
NASDAQ ITCH 5.0 Market Data Feed Handler
Loading...
Searching...
No Matches
b2bits::net::Endpoint Struct Reference

Generic network endpoint (IP address and port). More...

Detailed Description

Generic network endpoint (IP address and port).

Represents a network endpoint consisting of an IP address and port number. Used for both TCP and UDP connections to specify remote server addresses.

The endpoint supports:

  • Validity checking (non-empty IP and non-zero port)
  • Equality comparison
  • IPv4 and IPv6 addresses (as strings)
Note
Default constructed endpoint is invalid (empty IP, port = 0)
Example:
Endpoint server{"192.168.1.100", 8080};
if (server) { // Check validity
std::cout << "Connecting to " << server.ip_
<< ":" << server.port_ << std::endl;
}
Endpoint other{"192.168.1.100", 8080};
if (server == other) {
std::cout << "Same endpoint" << std::endl;
}
Generic network endpoint (IP address and port).
Definition Endpoint.h:48
std::uint16_t port_
Port number (0-65535, 0 = invalid).
Definition Endpoint.h:50
std::string ip_
IP address (IPv4 or IPv6 as string, e.g., "192.168.1.1" or "::1").
Definition Endpoint.h:49

#include <core/src/net/Endpoint.h>

Inheritance diagram for b2bits::net::Endpoint:

Public Member Functions

 operator bool () const
 Check if endpoint is valid.
bool operator== (const Endpoint &rhs) const
 Equality comparison operator.
bool operator!= (const Endpoint &rhs) const
 Inequality comparison operator.

Public Attributes

std::string ip_
 IP address (IPv4 or IPv6 as string, e.g., "192.168.1.1" or "::1").
std::uint16_t port_ = 0
 Port number (0-65535, 0 = invalid).

Member Function Documentation

◆ operator bool()

b2bits::net::Endpoint::operator bool ( ) const
inlineexplicit

Check if endpoint is valid.

An endpoint is considered valid if it has a non-empty IP address and a non-zero port number.

Returns
true if endpoint is valid (has IP and port), false otherwise

References ip_, and port_.

◆ operator!=()

bool b2bits::net::Endpoint::operator!= ( const Endpoint & rhs) const
inline

Inequality comparison operator.

Parameters
rhsEndpoint to compare with
Returns
true if IP or port differ, false otherwise

◆ operator==()

bool b2bits::net::Endpoint::operator== ( const Endpoint & rhs) const
inline

Equality comparison operator.

Two endpoints are equal if both their IP addresses and ports match.

Parameters
rhsEndpoint to compare with
Returns
true if IP and port are identical, false otherwise

References ip_, and port_.

Member Data Documentation

◆ ip_

std::string b2bits::net::Endpoint::ip_

IP address (IPv4 or IPv6 as string, e.g., "192.168.1.1" or "::1").

Referenced by operator bool(), and operator==().

◆ port_

std::uint16_t b2bits::net::Endpoint::port_ = 0

Port number (0-65535, 0 = invalid).

Referenced by operator bool(), and operator==().


The documentation for this struct was generated from the following file: