Hi there!
I wrote a simple loop black socket to see how much data I can exchange over Ethernet. The whole thing looks like this:
/*************************************************************************
TEST TCP Socket
*************************************************************************/
static int testDataListener(USOCKET Socket, unsigned char ucEvent, unsigned char *ucIp_Data, unsigned short usPortLen);
static USOCKET TCP_test_Socket;
#define test_port_number 6574
static int status = 0;
unsigned char ucTestData[] = {0,1,2,3,4,5,6,7,8,9};
/*************************************************************************
end
*************************************************************************/
static int testDataListener(USOCKET Socket, unsigned char ucEvent, unsigned char *ucIp_Data, unsigned short usPortLen)
{
switch (ucEvent) {
case TCP_EVENT_ABORT: //Connection not possible
break;
case TCP_EVENT_CONNECTED: //Connection has been established
break;
case TCP_EVENT_ACK: //An ACK has been received
break;
case TCP_EVENT_DATA: //Data has been received
if (fnSendTCP(TCP_test_Socket, ucIp_Data, usPortLen, TCP_FLAG_PUSH) > 0)
{
return APP_SENT_DATA;
}
break;
case TCP_EVENT_CLOSE: //Close request has been received
break;
case TCP_EVENT_CLOSED: //Connection has been closed
status = 1;
fnTCP_Listen(TCP_test_Socket, test_port_number, 0);
break;
case TCP_EVENT_REGENERATE: //Transmitted data has been lost
break;
case TCP_EVENT_CONREQ: //A remote client has requested a connection
break;
case TCP_EVENT_ARP_RESOLUTION_FAILED: //IP address of remote server not resolved
break;
case TCP_EVENT_PARTIAL_ACK: //Ack to some data (when windowing enabled)
break;
}
return APP_ACCEPT; //Standard reply which accepts
}
The received data is simply sent back. I'm not quite sure whether I used the functions/parameters correctly; in any case, the loop back works fine. I've got an app we used in an earlier project and it tells me that it works.
I sent some files and measured the speed, which was about 1 Mbps. What can I do to increase the speed? I need the board to receive and send huge amounts of data...
best regards,
Michael Bach