Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: PicoTCP lpc1768-picotcp-eth mbed-rtos mbed
Revision 0:609212dfbf2a, committed 2013-10-02
- Comitter:
- tass
- Date:
- Wed Oct 02 08:03:28 2013 +0000
- Commit message:
- TCP Official Rx Benchmark
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PicoTCP.lib Wed Oct 02 08:03:28 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/daniele/code/PicoTCP/#6764a53bb6e6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lpc1768-picotcp-eth.lib Wed Oct 02 08:03:28 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tass/code/lpc1768-picotcp-eth/#1ef61e7465a5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Oct 02 08:03:28 2013 +0000
@@ -0,0 +1,61 @@
+
+#include <mbed.h>
+#include <stdarg.h>
+#include "EthernetInterface.h"
+
+#define ECHO_SERVER_PORT 7
+#define BUFFER_QUANTITY (1024*1024)
+#define BUFFER_SIZE (1024)
+
+
+EthernetInterface eth;
+
+int main()
+{
+ TCPSocketServer server;
+
+ printf("Started PicoTCP Rx Benchmark....\n");
+
+ eth.init();
+ printf("Waiting for DHCP server to give IP...\n");
+
+ while(eth.connect() != 0);
+ printf("IP address assigned : %s\n",eth.getIPAddress());
+
+ server.bind(ECHO_SERVER_PORT);
+ server.listen();
+ printf("Local server listening on port : %d\n",ECHO_SERVER_PORT);
+
+
+ while (true) {
+ printf("\n>>> You can start PicoTCP_Official_TCP_Rx_Benchmark.py\n");
+
+ TCPSocketConnection client;
+ uint32_t startTime, stopTime;
+ server.accept(client);
+ client.set_blocking(false, 1500); // Timeout after (1.5)s
+
+ char buffer[BUFFER_SIZE];
+ int dataReceived = 0;
+
+ startTime = PICO_TIME_MS();
+ while(dataReceived < BUFFER_QUANTITY)
+ {
+ int n = client.receive(buffer, sizeof(buffer));
+ if (n <= 0) {
+ break;
+ }
+ dataReceived += n;
+ }
+ stopTime = PICO_TIME_MS();
+
+ if(dataReceived == BUFFER_QUANTITY)
+ {
+ printf("PicoTCP Rx Throughput is : %.3f Mbit/s\n" , (float)((BUFFER_QUANTITY*8.0)/(1000*(stopTime - startTime))));
+ }
+ else
+ {
+ printf("Benchmark failed !\n");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Wed Oct 02 08:03:28 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#ee87e782d34f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Oct 02 08:03:28 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file