I've created a TCP Server app using the "Network Ethernet Library" from Libstock.
Connecting to it with a simple C# application works find and i'am receiving some data.
My UserTCP method looks like this:
Code: Select all
void Net_Ethernet_28j60_UserTCP ( SOCKET_28j60_Dsc *socket )
{
// We only listen on port 1234
if( socket->destPort != 1234 )
return;
Debug.WriteLine( "User TCP" );
if ( m_tcpSocket == NULL )
{
Debug.WriteLine( "Socket opened" );
m_tcpSocket = socket;
Net_Ethernet_28j60_putStringTCP( "Hello", m_tcpSocket );
}
else
{
if ( m_bTcpSend )
{
Debug.WriteLine( "Send hello" );
Net_Ethernet_28j60_putStringTCP( "Hello", m_tcpSocket );
m_bTcpSend = 0;
}
}
}
But now i want the Server to actively send some data to the host without a request from the host.
I've read that i have to call "Net_Ethernet_28j60_startSendTCP" but the problem is that "Net_Ethernet_28j60_UserTCP" is never called anymore.
The TCP connection is still open.
Somewhere else in the code:
Code: Select all
m_bTcpSend = 1;
Net_Ethernet_28j60_startSendTCP( m_tcpSocket );
Am i understanding the concept right?