server/client

Dependencies:   mbed NetServicesMin

Revision:
0:432b571e11a3
Child:
1:6e61ee662fd3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Feb 19 06:21:50 2012 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "EthernetNetIf.h"
+#include "config.h"
+#include "tcp_server.h"
+#include "tcp_client.h"
+
+EthernetNetIf eth ;   
+
+Ticker connectCheck;
+ 
+int main() {
+
+
+    EthernetNetIf eth( //)  -- static IP address 
+        IpAddr(kSserverIp),     // IP Address
+        IpAddr(kSubnetMask),   // Subnet Mask
+        IpAddr(kRouterIp),     // Default Gateway
+        IpAddr(kRouterIp)      // DNS Server
+    ) ;
+
+    if( eth.setup() != ETH_OK )
+    {
+        printf("Ether Setup Error\r\n");
+        return -1;
+    }
+    printf("Setup OK\r\n");
+
+    IpAddr ip = eth.getIp() ;
+    printf("mbed IP Address is [%d.%d.%d.%d]\r\n", ip[0], ip[1], ip[2], ip[3]) ;
+
+    serverInit();
+    
+    clientInit();
+    connectCheckStart( IpAddr(kClientIp),kClientPort );
+
+    while(1) {
+        Net::poll();
+    }
+}