Sponge
CS144's user-space TCP library
address_dt.cc
Go to the documentation of this file.
1 #include "address.hh"
2 
3 #include <cstdlib>
4 #include <iostream>
5 #include <stdexcept>
6 
7 int main() {
8  try {
9 #include "address_example_1.cc"
10 #include "address_example_2.cc"
11 #include "address_example_3.cc"
12  if ((google_webserver.port() != 443) || (a_dns_server_numeric != 0x12'47'00'97)) {
13  throw std::runtime_error("unexpected value");
14  }
15  } catch (const std::exception &e) {
16  std::cerr << "This test requires Internet access and working DNS.\n";
17  std::cerr << "Error: " << e.what() << "\n";
18  return EXIT_FAILURE;
19  }
20  return EXIT_SUCCESS;
21 }
google_webserver
const Address google_webserver("www.google.com", "https")
address_example_3.cc
address_example_1.cc
a_dns_server_numeric
const uint32_t a_dns_server_numeric
Definition: address_example_3.cc:1
address.hh
Address::port
uint16_t port() const
Numeric port (host byte order).
Definition: address.hh:53
address_example_2.cc
main
int main()
Definition: address_dt.cc:7