MiMicSDK Tcp client socket sample program.

Dependencies:   NyFileSystems libMiMic mbed-rtos mbed

Fork of WebSocketSample by Ryo Iizuka

Files at this revision

API Documentation at this revision

Comitter:
nyatla
Date:
Tue Sep 15 10:14:06 2015 +0000
Parent:
28:d3627bd9b81d
Commit message:
update libMiMic

Changed in this revision

NyFileSystems.lib Show annotated file Show diff for this revision Revisions of this file
NySDFileSystem.lib Show diff for this revision Revisions of this file
libMiMic.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r d3627bd9b81d -r e19c4305f24b NyFileSystems.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NyFileSystems.lib	Tue Sep 15 10:14:06 2015 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/nyatla/code/NyFileSystems/#509d2ac0ba4f
diff -r d3627bd9b81d -r e19c4305f24b NySDFileSystem.lib
--- a/NySDFileSystem.lib	Wed Oct 23 05:07:05 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/nyatla/code/NySDFileSystem/#22ce3449b224
diff -r d3627bd9b81d -r e19c4305f24b libMiMic.lib
--- a/libMiMic.lib	Wed Oct 23 05:07:05 2013 +0000
+++ b/libMiMic.lib	Tue Sep 15 10:14:06 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/nyatla/code/libMiMic/#258e84040262
+http://mbed.org/users/nyatla/code/libMiMic/#e40058804062
diff -r d3627bd9b81d -r e19c4305f24b main.cpp
--- a/main.cpp	Wed Oct 23 05:07:05 2013 +0000
+++ b/main.cpp	Tue Sep 15 10:14:06 2015 +0000
@@ -24,8 +24,9 @@
 
 int main()
 {
-    net=new Net();//Net constructor must be created after started RTOS
-
+    MiMicNetIf netif;
+    Net net(netif);//Net constructor must be created after started RTOS
+    NetConfig cfg; //create network configulation
     // manual setting
     cfg.setIpAddr(192,168,128,39);
     cfg.setNetMask(255,255,255,0);
@@ -35,16 +36,16 @@
 
     // Create tcp socket with 512 bytes RX buffer.
     // Socket must create between "net.start" with "new Net()"
-    TcpSocket socket(512);
+    TcpSocket* socket=new TcpSocket();
     
     //Start network
-    net->start(cfg);
+    net.start(cfg);
 
 
     led1=1;    
     for(;;){
         //connect to server
-        if(!socket.connect(IpAddr(192,168,128,195),1234)){
+        if(!socket->connect(IpAddr(192,168,128,195),1234)){
             Thread::wait(1000);
         }
         //connected!
@@ -55,7 +56,7 @@
             //wait for data...
             const void* rx;
             //get read pointer
-            int l=socket.precv(rx);
+            int l=socket->precv(rx);
             if(l<0){
                 break;
             }
@@ -65,18 +66,18 @@
                 //ok,echo back data.
                 led4=1;
                 //send data
-                if(!socket.send(rx,l)){
+                if(!socket->send(rx,l)){
                     break;
                 }
                 //move read pointer.
-                socket.pseek(l);
+                socket->pseek(l);
             }
             led3=0;
         }
         led2=0;
         led3=0;
         led4=0;
-        socket.close(); //close the socket.
+        socket->close(); //close the socket.
     }
     return 0;
 }
diff -r d3627bd9b81d -r e19c4305f24b mbed-rtos.lib
--- a/mbed-rtos.lib	Wed Oct 23 05:07:05 2013 +0000
+++ b/mbed-rtos.lib	Tue Sep 15 10:14:06 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#53e6cccd8782
+http://mbed.org/users/mbed_official/code/mbed-rtos/#21b438192b0f
diff -r d3627bd9b81d -r e19c4305f24b mbed.bld
--- a/mbed.bld	Wed Oct 23 05:07:05 2013 +0000
+++ b/mbed.bld	Tue Sep 15 10:14:06 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/5e5da4a5990b
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad
\ No newline at end of file