438
« on: July 21, 2007, 02:49:44 PM »
Hi Mark,
I quickly tried to add a client, and have it connecting to my server application, but without any luck. Could you let me know what I am doing wrong? Here is the small code.. (It just simply connects, no sends/receives)
USOCKET Test_socket;
static int fnTestSocket(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:
if ((ucEvent == TCP_EVENT_REGENERATE) || (!uMemcmp((CHAR*)ucIp_Data, "TEST" , 4)))
{
} }
break;
case TCP_EVENT_ABORT:
case TCP_EVENT_CLOSED:
break;
}
return APP_ACCEPT;
}
Within the 'fnApplication(..)', making it the last bit of code within 'if (!iAppState)':
Test_socket = fnGetTCP_Socket(TOS_MINIMISE_DELAY, (unsigned short)20, fnTestSocket);
fnTCP_Connect(Test_socket, "192.168.0.184", 10000, 0, 0); //my server address and port...
The connection is never made (all done within simulator), and the call back function always gets called with switch value of '9'.
I have my server application running in debug, so I can tell when a connection is made.
Regards
Neil