Re: rabbit 5000 tcp client ucosII
"gangben" <gangben-/[email protected]>
| Newsgroups | gmane.comp.hardware.rabbit-semiconductor |
|---|---|
| Message-ID | <[email protected]> |
Thank you but I am quite sure that I have no new line in between it but tomorrow I'll check this. Is there any forumla to see how much storage I have to provide for a ucos task? greetings ben --- In [email protected], Tom Collins wrote: > > Your stack for the tcp task is too small. The safest is to use a 4KB stack, especially with DHCP. I believe the current DC 10 releases are better about stack usage, so you could possibly get away with a 2KB stack for the TCP task. I can almost guarantee that 512 bytes isn't enough. > > -Tom > > > On Jan 24, 2013, at 5:11 AM, gangben wrote: > > > Hi guys I want to write a tcp client with the rabbit. > > > > It has a simple functionallity it shall connect to a nodeJS server via > > localnetwork and send the input from the uart interface. > > > > In my example here I start ucosII and have 2 tasks one that is counting > > just some numbers and the other one shall keep the tcp connection alive > > with tcp_tick(); > > But here comes my problem it always says to me that the rabbit cannot > > open the tcp connection, tcp_open() fails > > > > What am I doing wrong? > > > > #define USE_LINKLOCAL > > #define TCPCONFIG 1 > > #define _PRIMARY_STATIC_IP "192.168.1.2" > > #define _PRIMARY_NETMASK "255.255.255.0" > > #define MY_GATEWAY "192.168.1.1" > > #define MY_NAMESERVER "0.0.0.0" > > > > #define TARGET > > "192.168.1.222" > > #define PORT 2222 > > > > #define AINBUFSIZE 63 > > #define AOUTBUFSIZE 127 > > #define BINBUFSIZE 63 > > #define BOUTBUFSIZE 127 > > #define CINBUFSIZE 63 > > #define COUTBUFSIZE 127 > > #define DINBUFSIZE 63 > > #define DOUTBUFSIZE 127 > > > > //important macro for the tcp connection > > #memmap xmem > > > > //libraries----------------------------------------------------------\ > > -------- > > > > #use "dcrtcp.lib" > > #use "net.lib" > > #use "tcp.lib" > > #use "ucos2.lib" > > > > //prototypes----------------------------------------------------------\ > > -------- > > > > //main----------------------------------------------------------\ > > -------- > > > > void print_task(void* ptr){ > > int i = 0; > > while(1){ > > printf("%d\n", i); > > i++; > > OSTimeDly(100); > > } > > } > > > > void tcpConnect(void* ptr){ > > static tcp_Socket socket; > > longword target_ip; > > > > if( 0L == (target_ip = resolve(TARGET)) ) { > > printf( "ERROR: Cannot resolve \"%s\" into an IP > > address\n", TARGET ); > > exit(2); > > } > > > > puts("ip address resolved\n"); > > > > if(!tcp_open(, 0, target_ip, 2222, NULL)){ > > puts("tcp_open() failed\n"); > > } > > > > puts("Waiting for establishment\n"); > > > > while(!sock_established() sock_bytesready()==-1){ > > tcp_tick(); > > puts(sockstate()); > > puts("\n"); > > } > > > > while(1){ > > tcp_tick(); > > } > > > > } > > > > main() > > { > > OSInit(); > > sock_init(); > > > > OSTaskCreate(print_task, NULL, 64,1); > > OSTaskCreate(tcpConnect, NULL, 512,0); > > > > OSStart(); > > }//end of main > > > > Thank you I hope you can help me > > > > >