TCP Multi Client server with Debug Server. Can handle multiple client requests and sends debug messages to a client connected to a different port. Tested on Landtiger and mbed

Dependencies:   EthernetInterface Server TCPDebug mbed-rtos mbed

Fork of ThreadServer by Ivan Shindev

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "EthernetInterface.h"
00003 #include "Server.h"
00004 #include "Debug.h"
00005 
00006 int main (void) {
00007    EthernetInterface eth;
00008    eth.init(); //Use DHCP
00009    eth.connect();
00010     
00011   int server_port=7;
00012   int debug_port=8;
00013   
00014  initDebug(); //initialize Debug server
00015  startDebug(debug_port);  //start the Debug server 
00016   while(!isDebugConnected()) //do nothing until a debug client is connected (optional)
00017   {
00018     wait(0.5);
00019   }
00020   
00021   startServer(server_port); //start server
00022   
00023  
00024   /* do your thing*/
00025  
00026 }