TCP Data Received CallBack or Interrupt

Discussion to talk about software related topics only.
Post Reply
ghost86
Posts: 1
Joined: Tue Oct 22, 2019 9:20 am

TCP Data Received CallBack or Interrupt

Post by ghost86 »

I must be going crazy, but i cannot find a function in the libraries for a TCP Data Received interrupt, or CallBack. I already attempted using the RegisterFDCallBack method but with no results. I know the processor has the functionality, there are register bits in the manual to control a data frame received interrupt. Is there a convenient function in the libraries? Otherwise, how have you all implemented code to be executed on a TCP data received event? NANO54415 NNDK V2.9.1
sulliwk06
Posts: 118
Joined: Tue Sep 17, 2013 7:14 am

Re: TCP Data Received CallBack or Interrupt

Post by sulliwk06 »

I always read my TCP data in a select() call. If I have to work with a lot of different TCP connections I make an entire task dedicated to accepting and reading from connections in a select() call and I register my own callbacks there. Looking at the RegisterFDCallBack function it looks like that is supposed to do what you want, what happened when you tried to use it? It seems like the callbacks registered there are the last thing that get called before the select calls are checked, so it shouldn't be that different than what I do, it's just done in the TCP task.
User avatar
pbreed
Posts: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: TCP Data Received CallBack or Interrupt

Post by pbreed »

The traditional approach is to make a task and use select.

You can also set up a callback for when data is availible.

once the tcp socket is open... and you have the fd...


#include <iointernal.h>

/*
***************************************************************************

Expanded file descriptor callback

Parameters:
tcpFd - Actual connection file descriptor
notifyHandler - Notification callback

Return:
None

Notes:
Data arrival or an connection error state calls this routine.

***************************************************************************
*/
typedef void ( tcp_read_notify_handler )( int tcpFd );
void RegisterTCPReadNotify( int tcpFd, tcp_read_notify_handler *notifyHandler );
Post Reply