Dear support team,
I tested transmitt between cc3200 (client) and PC(server) through my router. I tried different size of TCP window and I tried call sl_Send() faster. BUT my result is only 1,2 MBps. In Datasheet is transmittance 12MBps, so my result is very low. I ask you for some help, if is possible. I copied my code below.
1. Client connect to Server and send its serial number
2. Server send Packet with setting information
3. Client receive packet, change setting and start send packet. After that Client awaits for packet from server again.
Packet length is increasing each new sending section up to 1460 bytes. Distance between Server, Client and Router is 15cm and temperature in room is 22 Celsius. My computation ByteRate is:
(ByteRate per second) = [(quantity of received packets) /(Time)] * (Packet size)
Time ... 10s in my test
quantity of received packets ... how many packets server receive during 10s
Note for code: _buffLength is value expressing how many usefful value Client have to send. One value is 32bit integer (4 bytes) so this is reaosn why it is multiplication by 4 in Send() function.
My code:
//****
******************************
// SEND serial number
//**********************************
//filling the TCP server socket address
sAddr.sin_family = SL_AF_INET;
sAddr.sin_port = sl_Htons((unsigned short)PORT_NUM);
sAddr.sin_addr.s_addr = sl_Htonl((unsigned int)g_ulDestinationIp);
iAddrSize = sizeof(SlSockAddrIn_t);
// creating a TCP socket
iSockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, IPPROTO_TCP);
if( iSockID < 0 )
{
ASSERT_ON_ERROR(TCP_CLIENT_FAILED);
}
//set window size
SlSockWinsize_t size;
size.Winsize = 13140; // bytes
sl_SetSockOpt(iSockID,SL_SOL_SOCKET,SL_SO_RCVBUF, (_u8 *)&size, sizeof(size));
//set to send start packet
// connecting to TCP server
iStatus = sl_Connect(iSockID, ( SlSockAddr_t *)&sAddr, iAddrSize);
if( iStatus < 0 )
{
// error
ASSERT_ON_ERROR(sl_Close(iSockID));
ASSERT_ON_ERROR(TCP_CLIENT_FAILED);
}
while(_serial_num[m] != '*')
{
g_cBsdBuf[m] = _serial_num[m];
m++;
}
g_cBsdBuf[m] = '*';
iStatus = sl_Send(iSockID, g_cBsdBuf, sTestBufLen, 0 );
if( iStatus <= 0 )
{
// error
ASSERT_ON_ERROR(sl_Close(iSockID));
ASSERT_ON_ERROR(TCP_CLIENT_FAILED);
}
do
{
//**********************************
// Part for listen
//**********************************
// filling the buffer
for (iCounter=0 ; iCounter<50 ; iCounter++)
{
g_cBsdBuf[iCounter] = (char)(iCounter % 10);
}
iStatus = sl_Recv(SL_SOC_OK, g_cBsdBuf, 10025, 0);
aStartPacket = (PtrStartPacket)g_cBsdBuf;
iStatus = TestRecieveStartPacket(aStartPacket);
if( iStatus <= 0 )
{
// error
//ASSERT_ON_ERROR( sl_Close(iNewSockID));
ASSERT_ON_ERROR(sl_Close(iSockID));
ASSERT_ON_ERROR(TCP_SERVER_FAILED);
}
_count = aStartPacket->count;
_buffLength = aStartPacket->dataLen;
_IPDestination[0] = aStartPacket->IPDestination1;
_IPDestination[1] = aStartPacket->IPDestination2;
_IPDestination[2] = aStartPacket->IPDestination3;
_IPDestination[3] = aStartPacket->IPDestination4;
_port = aStartPacket->port;
//**********************************
// SEND data to destination IP address
//**********************************
Report("\n\t Recieved start packet successfully\n\r");
//write set option into console
Report("\n\r ***************************************");
Report("\n\r Option has been change to this setting:");
Report("\n\r1. Number of packets: %d", _count);
Report("\n\r2. Buffer size: %d", _buffLength);
//Report("\n\r3. IP Destination: %d.%d.%d.%d", _IPDestination[0], _IPDestination[1], _IPDestination[2], _IPDestination[3]);
//Report("\n\r4. Port: %d", _port);
//Report("\n\r ***************************************\n");
//Part to send packets
Report("\n\r");
Report("\n\r ***************************************");
Report("\n\r\tSending %d packets ", _count);
Report("\n\r ***************************************\n");
aDataPacket->count = aStartPacket->count;
aDataPacket->data = 15;
// filling the buffer;
g_sendBuf[0] = (int)'*';
g_sendBuf[1] = (int)aDataPacket->count;
g_sendBuf[2] = (int)1234;
g_sendBuf[3] = (int)'*';
if(_buffLength > 4)
for(m = 5; m <= _buffLength; m++)
g_sendBuf[m] = (int)m;
// sending multiple packets to the TCP server
Report("\n\rSize of message is: %dB", (_buffLength*4));
while(_count > 0)
{
iStatus = sl_Send(iSockID, g_sendBuf, (_buffLength*4), 0 );
iStatus = sl_Send(iSockID, g_sendBuf, (_buffLength*4), 0 );
iStatus = sl_Send(iSockID, g_sendBuf, (_buffLength*4), 0 );
iStatus = sl_Send(iSockID, g_sendBuf, (_buffLength*4), 0 );
if( iStatus <= 0 )
{
switch(iStatus)
{
case -10:
{
Report("\n\t!!The system limit on the total number of open socket, has been reached");
break;
}
case -12:
{
Report("\n\t!!Out of memory");
break;
}
case -105:
{
Report("\n\t!!!No buffer space available");
break;
}
default: break;
}
// error
Report("\n\t !!ERROR Ukoncuji prenos");
ASSERT_ON_ERROR(sl_Close(iSockID));
ASSERT_ON_ERROR(TCP_CLIENT_FAILED);
}
_count--;
}
aDataPacket->data = 15;
iStatus = sl_Send(iSockID, g_sendBuf, (_buffLength*4), 0 );
//Report("Sent %u packets successfully\n\r",g_ulPacketCount);
Report("\n\n\rSent packets successfully\n\r");
} while(aStartPacket->Continue > 0);
Thanks for help,
Usnul Jan