Utilities and cleanups for socket. (#9576)
- Use c++-17 nodiscard and nested ns. - Add bind method to socket. - Remove rabit parameters.
This commit is contained in:
@@ -73,4 +73,15 @@ TEST(Socket, Basic) {
|
||||
|
||||
system::SocketFinalize();
|
||||
}
|
||||
|
||||
TEST(Socket, Bind) {
|
||||
system::SocketStartup();
|
||||
auto any = SockAddrV4::InaddrAny().Addr();
|
||||
auto sock = TCPSocket::Create(SockDomain::kV4);
|
||||
std::int32_t port{0};
|
||||
auto rc = sock.Bind(any, &port);
|
||||
ASSERT_TRUE(rc.OK());
|
||||
ASSERT_NE(port, 0);
|
||||
system::SocketFinalize();
|
||||
}
|
||||
} // namespace xgboost::collective
|
||||
|
||||
Reference in New Issue
Block a user