00001 #ifndef tcputil_h 00002 #define tcputil_h 00003 00004 #include <iostream> 00005 using namespace std; 00006 00007 #include <stdlib.h> 00008 #include <string.h> 00009 00010 #include "SDL.h" 00011 #include "SDL_net.h" 00012 00013 // receive a buffer from a TCP socket with error checking 00014 // this function handles the memory, so it can't use any [] arrays 00015 // returns 0 on any errors, or a valid char* on success 00016 char *getMsg(TCPsocket sock, char **buf); 00017 00018 00019 // send a string buffer over a TCP socket with error checking 00020 // returns 0 on any errors, length sent on success 00021 int putMsg(TCPsocket sock, char *buf); 00022 00023 #endif