mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02:00
Add the option to bind to a specific address
This commit is contained in:
@@ -1506,11 +1506,13 @@ struct TestSocket: public TestBase
|
||||
void Run()
|
||||
{
|
||||
const int port = 30003;
|
||||
Address address(0,0,0,0, port);
|
||||
Address address6((IPv6AddressBytes*) NULL, port);
|
||||
|
||||
// IPv6 socket test
|
||||
{
|
||||
UDPSocket socket6(true);
|
||||
socket6.Bind(port);
|
||||
socket6.Bind(address6);
|
||||
|
||||
const char sendbuffer[] = "hello world!";
|
||||
IPv6AddressBytes bytes;
|
||||
@@ -1536,7 +1538,7 @@ struct TestSocket: public TestBase
|
||||
// IPv4 socket test
|
||||
{
|
||||
UDPSocket socket(false);
|
||||
socket.Bind(port);
|
||||
socket.Bind(address);
|
||||
|
||||
const char sendbuffer[] = "hello world!";
|
||||
socket.Send(Address(127,0,0,1,port), sendbuffer, sizeof(sendbuffer));
|
||||
@@ -1656,7 +1658,8 @@ struct TestConnection: public TestBase
|
||||
|
||||
infostream<<"** Creating server Connection"<<std::endl;
|
||||
con::Connection server(proto_id, 512, 5.0, false, &hand_server);
|
||||
server.Serve(30001);
|
||||
Address address(0,0,0,0, 30001);
|
||||
server.Serve(address);
|
||||
|
||||
infostream<<"** Creating client Connection"<<std::endl;
|
||||
con::Connection client(proto_id, 512, 5.0, false, &hand_client);
|
||||
|
Reference in New Issue
Block a user