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!