CLIENT SERVER 3000

Hello all… I NEED HELP!

I have been stuck for 2 days and with no luck!

Simple Client Server… 2 RCM3720 to a switch that my computer is on
this is my code for each…


/*******************************************************************************
	TCP_ECHO_CLIENT.c
	Z-World, 2000

        A basic client, that connects to a server and sends a packet waits for the
        server to echo it back and then sends again.  After 100 sends and receives
        a print out of the transfer times is shown in the stdio window.  This
        program will then start again.
*******************************************************************************/

#define MY_IP_ADDRESS 	"10.10.6.11"
#define MY_NETMASK 		"255.255.255.0"
#define MY_GATEWAY 		"10.10.6.1"
#define MY_PORT			8080

//************************************************************************************************
#define	ETH_MTU		 1500
#define  BUFF_SIZE	 (ETH_MTU-40)	//must be smaller than (ETH_MTU - (IP Datagram + TCP Segment))
#define  TCP_BUF_SIZE ((ETH_MTU-40)*4)	// sets up (ETH_MTU-40)*2 bytes for Tx & Rx buffers

//************************************************************************************************
#define TCPCONFIG 1
#memmap xmem
#use "dcrtcp.lib"

#define REMOTE_IP			"10.10.6.10"
#define REMOTE_PORT 		8080
#define NUM_OF_SENDS		100
#define TIME_OUT			1000	// if in any state for more than a second re-initialize

tcp_Socket sock;
int bytes,i;
static char buff[BUFF_SIZE];

int receive_packet(void)
{
	/* receive the packet */
	bytes = sock_fastread(&sock,buff,BUFF_SIZE);
	switch(bytes)
	{
		case -1:
			return 4; // there was an error go to state 4 (WAIT_CLOSE)
		case  0:
			return 3; // connection is okay, but no data received
		default:
			i--;
			return 2;	//now go to state 2 (SEND)
	}
}

int send_packet(void)
{
	/* send a packet */
	memset(buff,'C',BUFF_SIZE);
	buff[BUFF_SIZE-1] = '
';

	if(i<=0)
		return 3;

	bytes = sock_write(&sock,buff,BUFF_SIZE);
	switch(bytes)
	{
		case -1:
			return 4; // there was an error go to state 4 (WAIT_CLOSE)
		default:
			return 3;	//now go to state 3 (RECEIVE)
	}
}

main()
{
	int state,status;
	auto longword ipaddr;
	auto longword netmask;
	auto longword gateway;
	long statetime;
	float endtime,TimePerTrans,TimePerByte,TimePerBit,BitsPerTime;

	state = 0;
      ipaddr = inet_addr(MY_IP_ADDRESS);
   netmask = inet_addr(MY_NETMASK);
   gateway = inet_addr(MY_GATEWAY);

   ifconfig(IF_DEFAULT,
			         IFS_IPADDR, ipaddr,
			         IFS_NETMASK, netmask,
			         IFS_ROUTER_SET, gateway,
			         IFS_END);



	sock_init();

//**********************************************************************
// if using the RCM2200 with this program and a 10/100 switch, hub, or router
// you will need the following delay in order for the Realteck Chip to
// initialize and adjust to the correct speed
	#asm
		ld		hl,500			;500ms
		call	tickwait
	#endasm
//**********************************************************************

	while(1)
	{
		switch(state)
		{
			case 0:/*CREATE SESSION*/
				if(tcp_open(&sock,MY_PORT,resolve(REMOTE_IP),REMOTE_PORT,NULL))
					state++;									// complete move onto next state
				MS_TIMER = 0L;
				i = NUM_OF_SENDS;
				break;
			case 1:/*LISTEN*/
				if(sock_established(&sock))			// check for a connection
				{
					statetime = MS_TIMER = 0L;
					state++;									//   we have connection so move on
				}
				else if (MS_TIMER > TIME_OUT)			// if 1 sec and no sock
					state = 4;								//	  abort and re-init
				break;
			case 2:/*SEND*/
				statetime = MS_TIMER;					// reset time to be in the RECEIVE state
				state = send_packet();					// see function for details
				break;
			case 3:/*RECEIVE*/
				state = receive_packet();				// see function for details
				if (MS_TIMER > (statetime+TIME_OUT))// if 1 sec and still waiting
					state = 4;								//	  abort and re-init
				break;
			case 4:/*NO_WAIT_CLOSE*/
				sock_abort(&sock);						// close the socket
				state = 0;									// go back to the INIT state
		}
		status = tcp_tick(&sock);
		if(i==0)
		{
			endtime = (float)MS_TIMER/(float)1000;
			TimePerTrans = endtime/(float)(NUM_OF_SENDS*2);
			TimePerByte	 = TimePerTrans/(float)BUFF_SIZE;
			TimePerBit	 = TimePerByte/(float)8;
			BitsPerTime	 = (float)1/TimePerBit;

			printf("

Total Transfer Time:	%+fsec
",endtime);
			printf("Time per Trans:	%+fsec/trans
",TimePerTrans);
			printf("Time per Byte:	%+fsec/byte
", TimePerByte);
			printf("Time per Bit:	%+fsec/bit
",  TimePerBit);
			printf("Bits per Time:	%+fbits/sec
", BitsPerTime);
			i--;
			state = 4;
		}
	}
}

and the server


/*******************************************************************************
        TCP_ECHO_SERVER.c
        Z-World, 2000

        A basic server, that when a client connect, echos back to them
        any data that they send.
*******************************************************************************/

#define MY_IP_ADDRESS 	"10.10.6.10"
#define MY_NETMASK 		"255.255.255.0"
#define MY_GATEWAY 		"10.10.6.1"
#define MY_PORT 			8080

//************************************************************************************************
#define	ETH_MTU		 1500
#define  BUFF_SIZE	 (ETH_MTU-40)	//must be smaller than (ETH_MTU - (IP Datagram + TCP Segment))
#define  TCP_BUF_SIZE ((ETH_MTU-40)*4)	// sets up (ETH_MTU-40)*2 bytes for Tx & Rx buffers

//************************************************************************************************
#define TCPCONFIG 1
#memmap xmem
#use "dcrtcp.lib"

#define INCOMING_IP		0 		//except all connections
#define INCOMING_PORT	0		//except all ports
#define TIME_OUT			1000	// if in any state for more than a second re-initialize

tcp_Socket sock;
int bytes;
static char buff[BUFF_SIZE];

int receive_packet(void)
{
	/* receive the packet */
	bytes = sock_fastread(&sock,buff,BUFF_SIZE);

	switch(bytes)
	{
		case -1:
			return 4; // there was an error go to state 4 (NO_WAIT_CLOSE)
		case  0:
			return 2; // connection is okay, but no data received
		default:
			return 3;	//now go to state 3 (SEND)
	}
}

int send_packet(void)
{
	/* send the packet */
	bytes = sock_write(&sock,buff,bytes);
	switch(bytes)
	{
		case -1:
			return 4; // there was an error go to state 4 (NO_WAIT_CLOSE)
		default:
			return 2;	//now go to state 2 (RECEIVE)
	}
}

main()
{
	int state;
	auto longword ipaddr;
	auto longword netmask;
	auto longword gateway;
	state = 0;


   ipaddr = inet_addr(MY_IP_ADDRESS);
   netmask = inet_addr(MY_NETMASK);
   gateway = inet_addr(MY_GATEWAY);

   ifconfig(IF_DEFAULT,
			         IFS_IPADDR, ipaddr,
			         IFS_NETMASK, netmask,
			         IFS_ROUTER_SET, gateway,
			         IFS_END);






	sock_init();

	while(1)
	{
		switch(state)
		{
			case 0:/*INITIALIZATION*/					// listen for incoming connection
				tcp_listen(&sock,MY_PORT,INCOMING_IP,INCOMING_PORT,NULL,0);
				MS_TIMER = 0L;
				state++;										// init complete move onto next state
				break;
			case 1:/*LISTEN*/
				if(sock_established(&sock))			// check for a connection
					state++;									//   we have connection so move on
				else if (MS_TIMER > TIME_OUT)			// if 1 sec and no sock
					state = 4;								//	  abort and re-init
				break;
			case 2:/*RECEIVE*/
				state = receive_packet();				// see function for details
				if (MS_TIMER > TIME_OUT)				// if 1 sec and still waiting
					state = 4;								//	  abort and re-init
				break;
			case 3:/*SEND*/
				MS_TIMER = 0L;								// reset the timer
				state = send_packet();					// see function for details
		      printf("Sending...
");
				break;
			case 4:/*NO WAIT_CLOSE*/
				sock_abort(&sock);						// close the socket
				state = 0;									// go back to the INIT state
		}
		tcp_tick(&sock);
	}
}


I am not sending or receiving anything! I am getting suck in listen on client and server

Any pointers?