Thanks mark,
Acutally I able to locate why it was disconnected ..
(It was disconnected due to improper handling of partial Ack case, and event regen case)
I saw when some partail ACK case comes, then such 3-5 paritla ACK, regrenrate case get
executed and then connection get aborted.
I modified listner as below... and working well since morning..
Infact with my function DecodeTcpQuery() , I kept validation but for simplicity I had not shown
last time...
Though Now its working, Is below my code all right?
(As per performance and reliabilty conserns)
----------------------------------------------------------------------------------
static int fnTestListener(USOCKET Socket, unsigned char ucEvent, unsigned char *ucIp_Data, unsigned short usPortLen)
{
int n,i;
unsigned char TP[30];
TCP_MESSAGE test_message;
switch (ucEvent)
{
case TCP_EVENT_CONREQ:
case TCP_EVENT_CONNECTED: break;
if(ucEvent==TCP_EVENT_CONNECTED)
{
fnDebugMsg("\r\n####Socket Connected........#####");
sprintf(TP,"\r\nConn-SockID=%d",Socket);
fnDebugMsg(TP);
}
break;
case TCP_EVENT_ACK: break;
case TCP_EVENT_ARP_RESOLUTION_FAILED:break;
case TCP_EVENT_PARTIAL_ACK:
return APP_REQUEST_CLOSE;
case TCP_EVENT_REGENERATE:
// SEND OLD Know valid data Call_My_Fun(); followed by fnTcpSend(...)
return APP_SENT_DATA;
case TCP_EVENT_DATA:
if(DecodeTCPQuery(ucIp_Data)) // My Function
{
if (fnSendTCP(Socket, ResponceData, ResponceLen, TCP_FLAG_PUSH) > 0)
{
return APP_SENT_DATA;
}
}
break;
case TCP_EVENT_ABORT:
if(ucEvent==TCP_EVENT_ABORT)
{
fnDebugMsg("\r\n########## Aborted........##########");
sprintf(TP,"\r\nAbrt-SockID=%d",Socket);
fnDebugMsg(TP);
}
case TCP_EVENT_CLOSED:
if(ucEvent==TCP_EVENT_CONNECTED)
{
fnDebugMsg("\r\n########## CLOSED........##########");
sprintf(TP,"\r\nClose-SockID=%d",Socket);
fnDebugMsg(TP);
}
fnTCP_Listen(Socket, usTestPort, 0);
break;
}
return APP_ACCEPT;
}