Hello Android Socket
Sockets on Android

My attention was drawn today to this exciting blog post from Chih-Hao Chiu, a Taiwanese college student. I wanted to share it with you all as quickly as possible!

 

So many people using LiveCode are looking forward to sockets on Android. You can use socket on Windows, Linux, Mac OS and there is also an external for iOS. Now, I wrote a socket external for Android. Take a look at what I've done.

 

First, I use my notebook as a server, it's IP is 192.168.0.103.

My Android mobile phone is the client with the IP of 192.168.0.102.

 

Here's my demo stack, I'm going to show you the function on TCP socket. As you can see, the connection state on the top is "Closed" when I open the stack.

 



Laptop(left)  Android Phone (right)

 

When I hit "accept" the laptop starts to act like a server to wait for connections in.
The connection state then changes to "Waiting":

 


When the server is set up, I hit the "open" button on the Android phone. You can see the message tells that my phone is connected. The connection state change to "Connected" on the phone.

 



Next, when I hit button "write" on the laptop, the server will write a message which is typed on the "Send Message" area. On my mobile phone I can hit the button "read". The message that the server just sent will be received on the phone.

 


On the other hand, when I hit button "write" on the phone. Server should have received the message. This time I change the message to "From Android Phone"

 

Finally, when I close the connection on either side. Both the laptop and the phone will call a close message then answer the close message. (I have not changed the file descriptor to a real IP on Android so you can see the 52 on the screen)

 


That's all for today! Hope you enjoy it!

 

About The Author
Chih-Hao Chiu
"HedgeHao" is a college student from Taiwan and his major is Information management.
Read HedgeHao's Blog
Other Articles
HTML5 Questions Answered
   18.07.2014
What you want to know about the campaign to bring HTML5 to LiveCode. We answer real user questions that have been put to us.
Read more
 
 
Next Generation Progress
   18.07.2014
Its all go in Edinburgh with huge strides being made in all directions on our Next Generation project. Find out the latest from our developers.
Read more
Web Apps for Real People
   18.07.2014
Some use cases given to us from users regarding what they expect to use Web deployment for and why they are excited about it.
Read more
Hello Android Socket
   18.07.2014
Discover what one student in Taiwan has done to bring socket support to the Android platform. Open Source in Action!
Read more
 
Thank you for your time.

 

© LiveCode 2014