TCP Data Received CallBack or Interrupt
TCP Data Received CallBack or Interrupt
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
Re: TCP Data Received CallBack or Interrupt
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.
Re: TCP Data Received CallBack or Interrupt
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 );
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 );