1 #ifndef TEST_SOCKET_IP_COMMON_HPP_
2 #define TEST_SOCKET_IP_COMMON_HPP_
4 #include <posixx/socket/inet.hpp> // posixx::socket::inet
5 #include <posixx/socket/opt.hpp> // posixx::socket::opt::REUSEADDR
6 #include <ostream> // std::ostream
13 std::ostream& operator << (std::ostream& os,
14 const posixx::socket::inet::sockaddr& sa) throw()
16 return os << "inet::sockaddr(family=" << sa.sin_family
17 << ", port=" << ntohs(sa.sin_port)
18 << ", addr=" << inet_ntoa(sa.sin_addr) << ")";
22 void clean_test_address(posixx::socket::inet::socket& socket,
23 const posixx::socket::inet::sockaddr& addr)
25 // reuse the socket address (just in case)
26 socket.opt< posixx::socket::opt::REUSEADDR >(true);
29 static posixx::socket::inet::sockaddr test_address1(PORT1, IP);
30 static posixx::socket::inet::sockaddr test_address2(PORT2, IP);
32 #endif // TEST_SOCKET_IP_COMMON_HPP_