Home/Support/Support Forum/calling tcp_tick(NULL) vs tcp_tick(&socket)
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

calling tcp_tick(NULL) vs tcp_tick(&socket)

0 votes
My application has multiple opened sockets. Should I call tcp_tick(&socket_n) for each of them or can I just use tcp_tick(NULL) periodically?

Thank you,
asked May 24, 2016 in Rabbit by phungd New to the Community (3 points)

Please log in or register to answer this question.

2 Answers

0 votes
My preference is to call tcp_tick(NULL) unless there is a particular reason to give priority to a socket or sockets.

In our data loggers we use uCosII and have a separate task just for the tcp_tick() code so that we don't have to pepper the code with calls to tcp_tick(). This works quite well and you can tune the network performance by adjusting the task priority and also calling tcp_tick() more than once each time the task runs.

Regards,
Peter
answered May 25, 2016 by petermcs Veteran of the Digi Community (1,130 points)
0 votes
At least in Dynamic C 10, processing is identical regardless of what you pass. Whenever you call tcp_tick(), it processes received packets and manages all sockets. If you've passed a non-NULL value, tcp_tick() will return the result of calling sock_alive() for the socket you pass in.

If you're ignoring the return value of tcp_tick(), there isn't any reason to pass a non-NULL value.
answered May 25, 2016 by TomCollins Veteran of the Digi Community (1,520 points)
...