rabbit 5000 tcp client ucosII

"gangben" <gangben-/[email protected]>
Newsgroups gmane.comp.hardware.rabbit-semiconductor
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.