# tcp_game.cpp File Reference

Basic functions to receive and send TCP packets for game purposes. More...

`#include "../../stdafx.h"`
`#include "../network.h"`
`#include "../network_internal.h"`
`#include "../../debug.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Defines
#define | GAME_COMMAND(type) case type: return this->NetworkPacketReceive_ ## type ## _command(p); break;
| Defines a simple (switch) case for each network packet.
#define | DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(type)
| Create stub implementations for all receive commands that only show a warning that the given command is not available for the socket where the packet came from.

## Detailed Description

Basic functions to receive and send TCP packets for game purposes.

Definition in file tcp_game.cpp.

## Define Documentation

#define DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND | ( | type |  | ) |

Value:

    NetworkRecvStatus NetworkGameSocketHandler::NetworkPacketReceive_## type ##_command(Packet *p) \
    { \
      DEBUG(net, 0, "[tcp/game] received illegal packet type %d from client %d", \
          type, this->client_id); \
      return NETWORK_RECV_STATUS_MALFORMED_PACKET; \
    }

Create stub implementations for all receive commands that only show a warning that the given command is not available for the socket where the packet came from.

Parameters:

  | type | the packet type to create the stub for

Definition at line 158 of file tcp_game.cpp.

#define GAME_COMMAND | ( | type |  | ) | case type: return this->NetworkPacketReceive_ ## type ## _command(p); break;

Defines a simple (switch) case for each network packet.

Parameters:

  | type | the packet type to create the case for

Definition at line 63 of file tcp_game.cpp.

Referenced by NetworkGameSocketHandler::HandlePacket().