54 if ( newsock ==
NULL ) {
64 if ( which == CHAT_MAXPEOPLE ) {
75 fprintf(stderr,
"Killed inactive socket %d\n", which);
81 if ( which == CHAT_MAXPEOPLE ) {
87 fprintf(stderr,
"Connection refused -- chat room full\n");
91 people[which].sock = newsock;
95 fprintf(stderr,
"New inactive socket %d\n", which);
124 fprintf(stderr,
"Closing socket %d (was%s active)\n",
128 if (
people[which].active ) {
149 people[which].name[256] = 0;
151 fprintf(stderr,
"Activating socket %d (%s)\n",
152 which,
people[which].name);
200 fprintf(stderr,
"Couldn't initialize SDL: %s\n",
SDL_GetError());
206 fprintf(stderr,
"Couldn't initialize net: %s\n",
221 fprintf(stderr,
"Couldn't create socket set: %s\n",
228 printf(
"Server IP: %x, %d\n", serverIP.
host, serverIP.
port);
231 fprintf(stderr,
"Couldn't create server socket: %s\n",
DECLSPEC int SDLCALL SDLNet_TCP_Send(TCPsocket sock, const void *data, int len)
DECLSPEC int SDLCALL SDLNet_CheckSockets(SDLNet_SocketSet set, Uint32 timeout)
int main(int argc, char **argv)
static SDLNet_SocketSet socketset
#define SDLNet_SocketReady(sock)
DECLSPEC void SDLCALL SDLNet_FreeSocketSet(SDLNet_SocketSet set)
DECLSPEC int SDLCALL SDLNet_Init(void)
EGLImageKHR EGLint * name
static struct @98 people[CHAT_MAXPEOPLE]
DECLSPEC void SDLCALL SDL_Quit(void)
DECLSPEC const char *SDLCALL SDL_GetError(void)
DECLSPEC TCPsocket SDLCALL SDLNet_TCP_Accept(TCPsocket server)
DECLSPEC IPaddress *SDLCALL SDLNet_TCP_GetPeerAddress(TCPsocket sock)
void SendNew(int about, int to)
static __inline__ int SDLNet_TCP_AddSocket(SDLNet_SocketSet set, TCPsocket sock)
struct _SDLNet_SocketSet * SDLNet_SocketSet
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
DECLSPEC TCPsocket SDLCALL SDLNet_TCP_Open(IPaddress *ip)
DECLSPEC void SDLCALL SDLNet_Quit(void)
void cleanup(int exitcode)
DECLSPEC int SDLCALL SDLNet_ResolveHost(IPaddress *address, const char *host, Uint16 port)
struct _TCPsocket * TCPsocket
uint8_t Uint8
An unsigned 8-bit integer type.
static __inline__ int SDLNet_TCP_DelSocket(SDLNet_SocketSet set, TCPsocket sock)
DECLSPEC int SDLCALL SDL_Init(Uint32 flags)
DECLSPEC SDLNet_SocketSet SDLCALL SDLNet_AllocSocketSet(int maxsockets)
DECLSPEC int SDLCALL SDLNet_TCP_Recv(TCPsocket sock, void *data, int maxlen)
static TCPsocket servsock
DECLSPEC void SDLCALL SDLNet_TCP_Close(TCPsocket sock)
DECLSPEC const char *SDLCALL SDLNet_GetError(void)