2014年7月17日 星期四

Android Socket for LiveCode

So many people using LiveCode are looking forward to have a socket 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 which IP is 192.168.0.103
My Android mobile phone as a client which IP is 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 start to act like a server to wait for connections in.
The connection state then change 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. There server will write a message which is type on the "Send Message" area. On my mobile phone I can hit button "read". The message that the server just send 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 an close message then answer the close message. (I have not change the file descriptor to real IP on Android so you can see the 52 on the screen)
That's all for today! Hope you enjoy it!

3 則留言:

  1. 回覆
    1. Actually I'm not finish the code yet.
      so...there's no source code publish yet.
      sorry about that.

      刪除
  2. Hi,

    You have some brilliant externals but you make it very difficult to find. Your android sockets article.

    Can we purchase that please or why not open source it - im sure anybody who has a need will send you more than $7.99 like your other products

    回覆刪除