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
main.cpp
00001 #include "mbed.h" 00002 #include "EthernetInterface.h" 00003 00004 #define BUFFER_SIZE 1024 00005 #define NUMBER_OF_SECONDS (20*1000u) // 20 seconds 00006 00007 #define REMOTE_IP "192.168.100.2" 00008 #define REMOTE_PORT 2327 00009 #define NUMBER_OF_FRAMES 1000 00010 00011 int main() { 00012 00013 EthernetInterface eth; 00014 eth.init(); 00015 eth.connect(); 00016 00017 printf("Started UDP Fast Test...\n"); 00018 00019 UDPSocket server; 00020 Endpoint endp; 00021 char buffer[BUFFER_SIZE]; 00022 00023 printf("Remote endpoint @ %s:%d\n",REMOTE_IP,REMOTE_PORT); 00024 endp.set_address(REMOTE_IP,REMOTE_PORT); 00025 00026 printf("Binding result :%d\n", server.bind(REMOTE_PORT)); 00027 00028 server.bind(REMOTE_PORT); 00029 server.set_blocking(false,1000); 00030 00031 printf("Started sending packet flood...\n"); 00032 00033 while(true) 00034 { 00035 int cnt = 0; 00036 static uint32_t counter = 0; 00037 while(cnt<5) 00038 { 00039 memcpy(buffer,&counter,sizeof(counter)); 00040 int size = server.sendTo(endp,buffer,sizeof(buffer)); 00041 counter++; 00042 cnt++; 00043 } 00044 Thread::wait(1); 00045 } 00046 00047 server.close(); 00048 } 00049
Generated on Mon Jul 25 2022 08:21:14 by
1.7.2