Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mic

Pages: [1]
1
µTasker general / Re: Where can fnSendTCP(...) be called?
« on: July 29, 2008, 06:50:24 AM »
Hi Mark,

Thanks for your input. I changed the acknowledge to APP_ACCEPT and the communication recorded by Ethreal looks quite better.


Regards,

Michael

2
µTasker general / Where can fnSendTCP(...) be called?
« on: July 25, 2008, 05:58:02 PM »
Hi,

I try to understand how I can use the fnSendTCP function. Is it possible to use this function outside fnListener(...)?

My problem is following:

I have a TCP request to a client on the serial interface (Gateway functionality). After reception of the TCP frame I call the function fnWritetoMBrtu(). This function posts a message to the serial interface task. This is working.

My fnListener function looks like this:

Code: [Select]
static int fnMBtcpListener(USOCKET Socket, unsigned char ucEvent, unsigned char *ucIp_Data, unsigned short usPortLen)
{
switch(ucEvent)
{
case TCP_EVENT_CONREQ:
case TCP_EVENT_CONNECTED:
case TCP_EVENT_CLOSE:
case TCP_EVENT_ACK:
case TCP_EVENT_ARP_RESOLUTION_FAILED:
case TCP_EVENT_PARTIAL_ACK:
break;
case TCP_EVENT_REGENERATE:
case TCP_EVENT_DATA:
                //Extract MB Header from TCP data
fnExtractMBtcpData(&mbTcpMessageRx, ucIp_Data);
                //Send Message to Serial Interface Task
                fnWriteToMBrtu();

return APP_REJECT_DATA;
break;
case TCP_EVENT_ABORT:
case TCP_EVENT_CLOSED:
fnTCP_Listen(Socket, MODBUS_TCP_PORT, 0);
break;
default:
break;
}
return APP_ACCEPT;
}
   

Now my question: Where do I have to call the fnSendTCP(...) function?

At the moment I don't understand how coming back from the Serial Task to the fnListener(...) function. So I tried to call the fnSendTCP(...) within the serial task.

Code: [Select]

case DO_MB_TCP_TIMEOUT:
mbTcpMessageRx.mbTcpHeader.packetLength = 0x3;
uStrcpy((char*)mbTcpMessageRx.mbTcpData, mbException);
fnSendTCP(mbTcpSocket, (unsigned char *)&mbTcpMessageRx.tcpHeader, 9,
                       TCP_FLAG_PUSH);
uTaskerMonoTimer(TASK_U1K, (DELAY_LIMIT)(1*SEC), DO_TIMEOUT);
break;
   

I don't get the expected TCP response. Can anybody help me?


Regards,

Michael

Pages: [1]