This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Use TCPNet with RTX kernel

I want to use the TCPNet with RTX Kernel, but I have one question about it.

In www.keil.com/.../rlarm_tn_using_withkernel.htm
they say that tcp_poll_task is the lowest priority and in this task there is the main_() function.
Is it the intention that all my code to check if something came in and control it comes in here???

kind of like this: (but my switch would then be main_() )

void tcp_poll_task (void) __task { /* Main Thread of the TcpNet. This task should have */ /* the lowest priority because it is always READY. */ dhcp_tout = DHCP_TOUT; while (1) { main_TcpNet(); dhcp_check ();

switch (soc_state){ case 0: //nog geen verbinding => socket aanvragen en verbinding maken tcp_soc = tcp_get_socket (TCP_TYPE_CLIENT, 0, 120, tcp_callback); //2 minuten en dan timeout indien kanaal idle soc_state = 999; //niet bestaande soc_state geven zodat er gewacht wordt op callback functie case 1: //verbinding gemaakt en klaar om data te versturen }

os_tsk_pass(); }
}

Am I right here, or have I misinterpreted something?

Parents Reply Children
  • I'll replace the code down under and hopefully it's now displayed ok.

    void tcp_poll_task (void) __task {
       /* Main Thread of the TcpNet. This task should have */
       /* the lowest priority because it is always READY. */
       dhcp_tout = DHCP_TOUT;
       while (1) {
          main_TcpNet();
          dhcp_check ();
    
              switch (soc_state){
               case 0:      //nog geen verbinding => socket aanvragen en verbinding maken
                       tcp_soc = tcp_get_socket (TCP_TYPE_CLIENT, 0, 120, tcp_callback);  //2 minuten en dan timeout indien kanaal idle
                       soc_state = 999; //niet bestaande soc_state geven zodat er gewacht wordt op callback functie
               case 1:  //verbinding gemaakt en klaar om data te versturen
             }
    
          os_tsk_pass();
       }
    }
    

  • Is it needed that the tcp_callback function that is used for the indication of events to my socket is a process? Now I have it just as a function. When I try to connect to my server, I can see that the function has startded to try to make connection (return of the function tcp_connect() is __TRUE). But I never receive any connection state, I think this has to do with my callback function.

    Anyone who knows this for sure?

    Thanks

  • Could someone please post an example of how to use TCPNet with rtx kernel? I've been trying it for a couple of days now, and it won't work. I tried to get some sample code from the HTTP example, but all the code is in cgi files (wich I don't understand).

    When I try to make my connection I can see on my board that my socket is in the TCP_STATE_SYN_SENT waiting for an ACK. But when I snif my network for packets coming from my board, I can't seem to find them. When I try this with the LEDClient example I can see the packets passing.

    My guess is that I have some processes or inits or stacks wrong.

    So if someone could post some sample code for making a client connection to a server with rtx kernel (perhaps from the example file on www.keil.com/.../rlarm_tn_using_withkernel.htm ), I would appreciate this very much.

    Thanks in advance