#include <testGame.h>
Inheritance diagram for TNLTest::TestNetInterface:
TestNetInterface subclasses TNLTest to provide server pinging and response info packets. When a client TestNetInterface starts, it begins sending ping packets to the pingAddr address specified in the constructor. When a server receives a GamePingRequest packet, it sends a GamePingResponse packet to the source address of the GamePingRequest. Upon receipt of this response packet, the client attempts to connect to the server that returned the response. When the connection or connection attempt to that server is terminated, the TestNetInterface resumes pinging for available TNLTest servers.
Public Types | |
enum | Constants { PingDelayTime = 2000, GamePingRequest = FirstValidInfoPacketId, GamePingResponse } |
Constants used in this NetInterface. More... | |
Public Member Functions | |
TestNetInterface (TestGame *theGame, bool server, const TNL::Address &bindAddress, const TNL::Address &pingAddr) | |
Constructor for this network interface, called from the constructor for TestGame. | |
void | handleInfoPacket (const TNL::Address &address, TNL::U8 packetType, TNL::BitStream *stream) |
handleInfoPacket overrides the method in the NetInterface class to handle processing of the GamePingRequest and GamePingResponse packet types. | |
void | sendPing () |
sendPing sends a GamePingRequest packet to pingAddress of this TestNetInterface. | |
void | tick () |
Tick checks to see if it is an appropriate time to send a ping packet, in addition to checking for incoming packets and processing connections. | |
Data Fields | |
bool | pingingServers |
True if this is a client that is pinging for active servers. | |
TNL::U32 | lastPingTime |
The last platform time that a GamePingRequest was sent from this network interface. | |
bool | isServer |
True if this network interface is a server, false if it is a client. | |
TNL::SafePtr< TestConnection > | connectionToServer |
A safe pointer to the current connection to the server, if this is a client. | |
TNL::Address | pingAddress |
Network address to ping in searching for a server. This can be a specific host address or it can be a LAN broadcast address. | |
TestGame * | game |
The game object associated with this network interface. | |
Private Types | |
typedef TNL::NetInterface | Parent |
|
|
|
Constants used in this NetInterface.
|
|
Constructor for this network interface, called from the constructor for TestGame. The constructor initializes and binds the network interface, as well as sets parameters for the associated game and whether or not it is a server. |
|
handleInfoPacket overrides the method in the NetInterface class to handle processing of the GamePingRequest and GamePingResponse packet types.
|
|
sendPing sends a GamePingRequest packet to pingAddress of this TestNetInterface.
|
|
Tick checks to see if it is an appropriate time to send a ping packet, in addition to checking for incoming packets and processing connections.
|
|
True if this is a client that is pinging for active servers.
|
|
The last platform time that a GamePingRequest was sent from this network interface.
|
|
True if this network interface is a server, false if it is a client.
|
|
A safe pointer to the current connection to the server, if this is a client.
|
|
Network address to ping in searching for a server. This can be a specific host address or it can be a LAN broadcast address.
|
|
The game object associated with this network interface.
|