TCP Programm

hi, i tried to programm a simple tcp clinet that the rabbit is sending a string to a server.

i tried all the samples that i found but i could never get any connection. I have connected notebook and rabbit via a cross over cable and additionally i put them both in a switch for my local network.

i know both ip addresses and can ping both through the console but how can i programm a simple communication…

can anyone help me with a simple hello world or something that i can see how it must be done??

Wireshark, a network analyzer will tell you if the rabbit is even trying to make the TCP connection:
http://www.digi.com/support/kbase/kbaseresultdetl.jsp?id=840

Keith

If you are trying to use the rabbit board as a client, then the presumption is you are issuing a connect API call from the rabbit software. Now if you can truly ping the rabbit board (this of course presumes that there is not another device on the network which shares the same IP address as the rabbit board - not outside the realm of possibility) then a first guess is that the port to which you are trying to connect is not the same port that the server to which you are trying to connect is waiting on (what the server’s accept API is waiting on).

As kjensen mentioned earlier, using the wireshark network protocol analyzer will confirm 1) whether of not you are attempting to connect to the port on which the server trying to accept and further 2) will confirm whether the rabbit board is actually sending anything out at all.

@gentleben, try this code (client.cs).

/////////////////////////////////////////////////////////////
// listen on pc server with
// IP Address :192.168.1.3 Port: 1234
// Netmask: 255.255.255.0
/////////////////////////////////////////////////////////////

// client.cs


#class auto
#define TCPCONFIG 1
#define _PRIMARY_STATIC_IP  "192.168.1.2"       // your rabbit ip as client
#define _PRIMARY_NETMASK "255.255.255.0"   
#define MY_GATEWAY "192.168.1.1"
#define MY_NAMESERVER "192.168.1.1"

#define IFC_WIFI_SSID "linksys"   // access point ssid
#define IFC_WIFI_ROAM_ENABLE 1
#define IFC_WIFI_ROAM_BEACON_MISS 20
#define IFC_WIFI_MODE IFPARAM_WIFI_INFRASTRUCTURE
#define IFC_WIFI_ENCRYPTION IFPARAM_WIFI_ENCR_NONE

#use "dcrtcp.lib"

#define  DEST 		"192.168.1.3"       // ip server (computer)
#define  PORT 		1234                     // port server

////////////////////////////////////////////////////////////////////////

void main()
{

	char	buffer[100];
	int 	bytes_read;
	longword  destIP;
	tcp_Socket socket;

	sock_init_or_exit(1);

	if( 0L == (destIP = resolve(DEST)) ) {
	   exit(2);
	}
	tcp_open(&socket,0,destIP,PORT,NULL);

	while(!sock_established(&socket) && sock_bytesready(&socket)==-1) {
		tcp_tick(NULL);
	}

	printf("Connection established
");

	sock_write(&socket,"test",4);

	do {
		bytes_read=sock_fastread(&socket,buffer,sizeof(buffer)-1);

		if(bytes_read>0) {
			buffer[bytes_read] = '\0';
			printf("%s",buffer);
		}
	} while(tcp_tick(&socket));

	sock_abort(&socket);
	printf("
Connection closed...
");
}

It would be helpful if you provide some more information about TCP Program.