#include #include #include #include #define MAXLEN 1024 // Server int main(int argc, char **argv) { int continuerBoucle = 1, result = 0; char msg[MAXLEN]; if(SDL_Init(0) == -1) { printf("%s\n", SDL_GetError()); exit(EXIT_FAILURE); } else { atexit(SDL_Quit); /* Initialisation SDL_net */ if(SDLNet_Init() == -1) { printf("%s\n", SDLNet_GetError()); exit(EXIT_FAILURE); } } /* TCP connexion check */ while(continuerBoucle) { /* Variables */ IPaddress adresse; SDLNet_ResolveHost(&adresse, NULL, 8465); TCPsocket socket, newsocket; /* TCP connexion */ socket = SDLNet_TCP_Open(&adresse); if(!socket) { printf("%s\n", SDLNet_GetError()); exit(EXIT_FAILURE); } /* TCP socket acceptation */ newsocket = SDLNet_TCP_Accept(socket); if(newsocket != NULL) { result = SDLNet_TCP_Recv(socket, msg, MAXLEN); printf("Boogie woogie !\n"); } /* Closing TCP connexion */ SDLNet_TCP_Close(socket); } SDLNet_Quit(); SDL_Quit(); return EXIT_SUCCESS; }