diff options
author | rubidium <rubidium@openttd.org> | 2009-04-07 20:27:13 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-04-07 20:27:13 +0000 |
commit | 2a6e9288fd9e238c2f0b68243fced9e3cf794100 (patch) | |
tree | 6cab21c9baf3fb1ca74033e132561b40ed015d91 /src/network/core/udp.h | |
parent | 6db7f15b3ad8addb7187bec3d309a4e6481ac431 (diff) | |
download | openttd-2a6e9288fd9e238c2f0b68243fced9e3cf794100.tar.xz |
(svn r15971) -Codechange: make it possible for UDP socket handlers to bind to multiple sockets.
Diffstat (limited to 'src/network/core/udp.h')
-rw-r--r-- | src/network/core/udp.h | 11 |
1 files changed, 9 insertions, 2 deletions
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); |