14 #ifndef NETWORK_CORE_TCP_H 15 #define NETWORK_CORE_TCP_H 43 bool IsConnected()
const {
return this->sock != INVALID_SOCKET; }
76 static void ThreadEntry(
void *param);
98 static void CheckCallbacks();
99 static void KillAll();
NetworkAddress address
Address we're connecting to.
SOCKET sock
The socket currently connected to.
Internal entity of a packet.
The connection got closed.
"Helper" class for creating TCP connections in a non-blocking manner
bool aborted
Whether we bailed out (i.e. connection making failed)
SOCKET sock
The socket we're connecting with.
Base socket handler for all TCP sockets.
Wrapper for (un)resolved network addresses; there's no reason to transform a numeric IP to a string a...
class ThreadObject * thread
Thread used to create the TCP connection.
virtual void OnConnect(SOCKET s)
Callback when the connection succeeded.
virtual Packet * ReceivePacket()
Receives a packet for the given client.
SendPacketsState SendPackets(bool closing_down=false)
Sends all the buffered packets out for this client.
virtual void OnFailure()
Callback for when the connection attempt failed.
virtual NetworkRecvStatus CloseConnection(bool error=true)
Close the current connection; for TCP this will be mostly equivalent to Close(), but for UDP it just ...
bool writable
Can we write to this socket?
Packet * packet_recv
Partially received packet.
NetworkRecvStatus
Status of a network client; reasons why a client has quit.
Wrapper for network addresses.
All packets in the queue are sent.
virtual ~TCPConnecter()
Silence the warnings.
The buffer is still full, so no (parts of) packets could be sent.
bool killed
Whether we got killed.
bool connected
Whether we succeeded in making the connection.
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
The packets are partly sent; there are more packets to be sent in the queue.
bool IsConnected() const
Whether this socket is currently bound to a socket.
Basic functions to create, fill and read packets.
virtual void SendPacket(Packet *packet)
This function puts the packet in the send-queue and it is send as soon as possible.
bool HasSendQueue()
Whether there is something pending in the send queue.
bool CanSendReceive()
Check whether this socket can send or receive something.
SendPacketsState
The states of sending the packets.
NetworkTCPSocketHandler(SOCKET s=INVALID_SOCKET)
Construct a socket handler for a TCP connection.
Packet * packet_queue
Packets that are awaiting delivery.
A Thread Object which works on all our supported OSes.
SocketHandler for all network sockets in OpenTTD.