_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include "stratagus.h"
#include "netdriver.h"
#include "net_lowlevel.h"
netdriver.cpp - Session mangement (SDL_net Socket Implementation). | |
#define | LINK(first, item, last, count) |
#define | UNLINK(first, item, last, count) |
static Socket | MasterSocket |
SessionPool * | Pool |
external reference to session tracking. More... | |
ServerStruct | Server |
void | Send (Session *session, const char *msg) |
int | ServerInit (int port) |
void | ServerQuit (void) |
static int | IdleSeconds (Session *session) |
static int | KillSession (Session *session) |
static void | AcceptConnections () |
static void | KickIdlers (void) |
static int | ReadData () |
int | UpdateSessions (void) |
#define LINK | ( | first, | |
item, | |||
last, | |||
count | |||
) |
LINK
Adds an item to a linked list.
#define UNLINK | ( | first, | |
item, | |||
last, | |||
count | |||
) |
UNLINK
Removes an item from the linked list.
|
static |
Accept new connections
|
static |
Returns time (in seconds) that a session has been idle.
session | This is the session we are checking. |
|
static |
Kick idlers
|
static |
Destroys and cleans up session data.
session | Reference to the session to be killed. |
|
static |
Read data
void Send | ( | Session * | session, |
const char * | msg | ||
) |
Send a message to a session
session | Session to send the message to |
msg | Message to send |
int ServerInit | ( | int | port | ) |
Initialize the server
port | Defines the port to which the server will bind. |
void ServerQuit | ( | void | ) |
ServerQuit: Releases the server socket.
int UpdateSessions | ( | void | ) |
Accepts new connections, receives data, manages buffers,
|
static |
SessionPool* Pool |
external reference to session tracking.
ServerStruct Server |