From 2a6e9288fd9e238c2f0b68243fced9e3cf794100 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 7 Apr 2009 20:27:13 +0000 Subject: (svn r15971) -Codechange: make it possible for UDP socket handlers to bind to multiple sockets. --- src/network/core/udp.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/network/core/udp.h') diff --git a/src/network/core/udp.h b/src/network/core/udp.h index 20e228100..2302dab0d 100644 --- a/src/network/core/udp.h +++ b/src/network/core/udp.h @@ -96,6 +96,11 @@ enum PacketUDPType { /** Base socket handler for all UDP sockets */ class NetworkUDPSocketHandler : public NetworkSocketHandler { protected: + /** The address to bind to. */ + NetworkAddressList bind; + /** The opened sockets. */ + SocketList sockets; + NetworkRecvStatus CloseConnection(); /* Declare all possible packets here. If it can be received by the @@ -124,13 +129,15 @@ protected: */ virtual void HandleIncomingNetworkGameInfoGRFConfig(GRFConfig *config) { NOT_REACHED(); } public: + NetworkUDPSocketHandler(NetworkAddressList *bind = NULL); + /** On destructing of this class, the socket needs to be closed */ virtual ~NetworkUDPSocketHandler() { this->Close(); } - bool Listen(NetworkAddress address, bool broadcast); + bool Listen(); void Close(); - void SendPacket(Packet *p, NetworkAddress *recv); + void SendPacket(Packet *p, NetworkAddress *recv, bool all = false, bool broadcast = false); void ReceivePackets(); void Send_NetworkGameInfo(Packet *p, const NetworkGameInfo *info); -- cgit v1.2.3-54-g00ecf