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!