More netlib troubles

Hi,

Sorry to bother you guys again, but I’ve gotten further with my netlib
based code. I can now send a message from the server, and have the
client receive, and send back a response. The problem is that I can’t
send out another message from the server after the response.

Here are the relevant sections of code:

/* client header file */

#include <stdio.h>
#include <SDL/SDL.h>
#include “SDL/SDLnet.h”

struct client
{

char data[4096];
char data2[4096];
char *hostname;
int clientNumber;

TCPsocket *tcpsock;
TCPsocket *newsock;
IPaddress serverIP;
IPaddress *myip;

} clients;

void clientConnect(void);
void clientSend(void);
void clientReceive(void);

/* server header file */

#include <stdio.h>
#include “SDL/SDL.h”
#include “SDL/SDLnet.h”
/* Prototypes */

void serverStart(void); /* Starts the server /
void serverSendData(void); /
Sends data to the client(s) /
void serverGetData(void); /
Receives data from clients /
void serverSetPlayer(void); /
Sets which player each client is /
void serverSetPlayerPositions(void); /
Sets positions for each player
on the screen of the client */
struct serv
{
int clientCount;
char data[4096];
char data2[20];
TCPsocket newsock;
TCPsocket secsock;

TCPsocket servsock;
IPaddress serverIP;

} server;

oops, I thought this message never made it. Netscape crashed during a
paste. The second one will have the functions for the client and server

Sorry.

Mike

Mike McLean wrote:>

Hi,

Sorry to bother you guys again, but I’ve gotten further with my netlib
based code. I can now send a message from the server, and have the
client receive, and send back a response. The problem is that I can’t
send out another message from the server after the response.

Here are the relevant sections of code:

/* client header file */

#include <stdio.h>
#include <SDL/SDL.h>
#include “SDL/SDLnet.h”

struct client
{

    char data[4096];
    char data2[4096];
    char *hostname;
    int clientNumber;

    TCPsocket *tcpsock;
    TCPsocket *newsock;
    IPaddress serverIP;
    IPaddress *myip;

} clients;

void clientConnect(void);
void clientSend(void);
void clientReceive(void);

/* server header file */

#include <stdio.h>
#include “SDL/SDL.h”
#include “SDL/SDLnet.h”
/* Prototypes */

void serverStart(void); /* Starts the server /
void serverSendData(void); /
Sends data to the client(s) /
void serverGetData(void); /
Receives data from clients /
void serverSetPlayer(void); /
Sets which player each client is /
void serverSetPlayerPositions(void); /
Sets positions for each player
on the screen of the client */
struct serv
{
int clientCount;
char data[4096];
char data2[20];
TCPsocket newsock;
TCPsocket secsock;

    TCPsocket servsock;
    IPaddress serverIP;

} server;