TCP Server that handles multiple client requests at the same time by using multiple threads

Dependents:   ThreadServer Server_Multi_Client

Revision:
1:e1db78d5ccc1
Parent:
0:a5fdd089d5c6
Child:
2:1b1f3ab29984
Child:
4:c57a998796ae
--- a/Server.cpp	Tue Jun 11 20:43:21 2013 +0000
+++ b/Server.cpp	Tue Jun 11 21:11:33 2013 +0000
@@ -1,17 +1,37 @@
+/*
+** File name:            Server.cpp
+** Descriptions:        TCP server that handles multiple client requests in separate threads
+**
+**------------------------------------------------------------------------------------------------------
+** Created by:            Ivan Shindev
+** Created date:        06/11/2013
+** Version:                1.0
+** Descriptions:        The original version
+**
+**------------------------------------------------------------------------------------------------------
+** Modified by:            
+** Modified date:    
+** Version:
+** Descriptions:        
+********************************************************************************************************/
 #include "Server.h"
 
 #include "mbed.h"
 
+/*Handle_client handles the client request
+*
+* Default: Echo the clients request
+*/
 
 void Handle_client(void const *socket_data) {
    
    int socket; 
    char buffer[256];
    socket = (int)socket_data;
-   int n = lwip_recv(socket ,buffer,sizeof(buffer),0); 
+   
+   int n = lwip_recv(socket ,buffer,sizeof(buffer),0); //read from the client
 
-
-   if (lwip_send(socket ,buffer,n,0)!=n) //send the content of the shared memory back to the socket 
+   if (lwip_send(socket ,buffer,n,0)!=n) //send the content back to the socket 
    {
    
  
@@ -44,8 +64,8 @@
         return -1;
     }
     localHost.sin_family = AF_INET;
-    localHost.sin_port = htons(_port);
-    localHost.sin_addr.s_addr = INADDR_ANY;
+    localHost.sin_port = htons(_port); //port
+    localHost.sin_addr.s_addr = INADDR_ANY;  //localhost address
     
     if (lwip_bind(socket_server, (const struct sockaddr *) &localHost, sizeof(localHost)) < 0) {