project_files/frontlib/socket.c
author Medo <smaxein@googlemail.com>
Tue, 12 Jun 2012 11:25:05 +0200
changeset 7224 5143861c83bd
parent 7179 f84805e6df03
child 7234 613998625a3c
permissions -rw-r--r--
Cleanup, refactoring and generally more development in the frontlib
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
     1
#include "socket.h"
7179
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
     2
#include "util/logging.h"
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
     3
#include "util/util.h"
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
     4
#include <stdlib.h>
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
     5
#include <SDL_net.h>
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
     6
#include <time.h>
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
     7
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
     8
typedef struct _flib_tcpsocket {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
     9
	TCPsocket sock;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    10
	SDLNet_SocketSet sockset;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    11
} _flib_tcpsocket;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    12
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    13
typedef struct _flib_acceptor {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    14
	TCPsocket sock;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    15
	uint16_t port;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    16
} _flib_acceptor;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    17
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    18
static uint32_t get_peer_ip(TCPsocket sock) {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    19
	IPaddress *addr = SDLNet_TCP_GetPeerAddress(sock);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
	return SDLNet_Read32(&addr->host);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    23
static bool connection_is_local(TCPsocket sock) {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    24
	return get_peer_ip(sock) == (uint32_t)((127UL<<24)+1); // 127.0.0.1
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    25
}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    26
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    27
static flib_tcpsocket *flib_socket_create(TCPsocket sdlsock) {
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    28
	flib_tcpsocket *result = flib_calloc(1, sizeof(_flib_tcpsocket));
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    29
	if(!result) {
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    30
		return NULL;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    31
	}
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    32
	result->sock = sdlsock;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    33
	result->sockset = SDLNet_AllocSocketSet(1);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    34
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    35
	if(!result->sockset) {
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    36
		flib_log_e("Can't allocate socket: Out of memory!");
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    37
		SDLNet_FreeSocketSet(result->sockset);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    38
		free(result);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    39
		return NULL;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    40
	}
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    41
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    42
	SDLNet_AddSocket(result->sockset, (SDLNet_GenericSocket)result->sock);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    43
	return result;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    44
}
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    45
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    46
flib_acceptor *flib_acceptor_create(uint16_t port) {
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    47
	flib_acceptor *result = flib_calloc(1, sizeof(_flib_acceptor));
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    48
	if(!result) {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    49
		return NULL;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    50
	}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    51
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    52
	IPaddress addr;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    53
	addr.host = INADDR_ANY;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    54
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    55
	if(port > 0) {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    56
		result->port = port;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    57
		SDLNet_Write16(port, &addr.port);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    58
		result->sock = SDLNet_TCP_Open(&addr);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    59
		if(result->sock) {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    60
			return result;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    61
		} else {
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    62
			flib_log_e("Unable to listen on port %u: %s", (unsigned)port, SDLNet_GetError());
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    63
			free(result);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    64
			return NULL;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    65
		}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    66
	} else {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    67
		/* SDL_net does not seem to have a way to listen on a random unused port
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    68
		   and find out which port that is, so let's try to find one ourselves. */
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    69
		srand(time(NULL));
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    70
		rand();
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    71
		for(int i=0; i<1000; i++) {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    72
			// IANA suggests using ports in the range 49152-65535 for things like this
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    73
			result->port = 49152+(rand()%(65535-49152));
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    74
			SDLNet_Write16(result->port, &addr.port);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    75
			result->sock = SDLNet_TCP_Open(&addr);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    76
			if(result->sock) {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    77
				return result;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    78
			} else {
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    79
				flib_log_w("Unable to listen on port %u: %s", (unsigned)result->port, SDLNet_GetError());
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    80
			}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    81
		}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    82
		flib_log_e("Unable to listen on a random unused port.");
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    83
		free(result);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    84
		return NULL;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    85
	}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    86
}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    87
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    88
uint16_t flib_acceptor_listenport(flib_acceptor *acceptor) {
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    89
	if(!acceptor) {
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    90
		flib_log_e("Call to flib_acceptor_listenport with acceptor==null");
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    91
		return 0;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
    92
	}
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    93
	return acceptor->port;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    94
}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
    95
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    96
void flib_acceptor_close(flib_acceptor *acceptor) {
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    97
	if(acceptor) {
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    98
		SDLNet_TCP_Close(acceptor->sock);
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    99
		free(acceptor);
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   100
	}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   101
}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   102
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   103
flib_tcpsocket *flib_socket_accept(flib_acceptor *acceptor, bool localOnly) {
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   104
	if(!acceptor) {
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   105
		flib_log_e("Call to flib_socket_accept with acceptor==null");
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   106
		return NULL;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   107
	}
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   108
	flib_tcpsocket *result = NULL;
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   109
	TCPsocket sock = NULL;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   110
	while(!result && (sock = SDLNet_TCP_Accept(acceptor->sock))) {
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   111
		if(localOnly && !connection_is_local(sock)) {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   112
			flib_log_i("Rejected nonlocal connection attempt from %s", flib_format_ip(get_peer_ip(sock)));
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   113
			SDLNet_TCP_Close(sock);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   114
		} else {
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   115
			result = flib_socket_create(sock);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   116
			if(!result) {
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   117
				SDLNet_TCP_Close(sock);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   118
			}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   119
		}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   120
	}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   121
	return result;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   122
}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   123
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   124
void flib_socket_close(flib_tcpsocket *sock) {
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   125
	if(sock) {
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   126
		SDLNet_DelSocket(sock->sockset, (SDLNet_GenericSocket)sock->sock);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   127
		SDLNet_TCP_Close(sock->sock);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   128
		SDLNet_FreeSocketSet(sock->sockset);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   129
		free(sock);
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   130
	}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   131
}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   132
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   133
int flib_socket_nbrecv(flib_tcpsocket *sock, void *data, int maxlen) {
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   134
	if(!sock || (maxlen>0 && !data)) {
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   135
		flib_log_e("Call to flib_socket_nbrecv with sock==null or data==null");
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   136
		return -1;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   137
	}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   138
	int readySockets = SDLNet_CheckSockets(sock->sockset, 0);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   139
	if(readySockets>0) {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   140
		int size = SDLNet_TCP_Recv(sock->sock, data, maxlen);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   141
		return size>0 ? size : -1;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   142
	} else if(readySockets==0) {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   143
		return 0;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   144
	} else {
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   145
		flib_log_e("Error in select system call: %s", SDLNet_GetError());
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   146
		return -1;
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   147
	}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   148
}
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   149
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   150
int flib_socket_send(flib_tcpsocket *sock, const void *data, int len) {
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   151
	if(!sock || (len>0 && !data)) {
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   152
		flib_log_e("Call to flib_socket_send with sock==null or data==null");
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   153
		return -1;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents: 7171
diff changeset
   154
	}
7171
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   155
	return SDLNet_TCP_Send(sock->sock, data, len);
906e72caea7b frontlib refactoring
Medo <smaxein@googlemail.com>
parents:
diff changeset
   156
}