开发者

Android App Development - Start a chat with computer device using android phone

I'm trying to learn android and for my app i have few questions.

  1. If i type a computer name on the EditText in my android phone, I should be able to ping the device (So basically i need to first resolve the ARP to get the mac address of the device which I want to ping and then send the ping as an ICMP request).

    I believe there is some command to retrieve the computer name and send this ping command, but i would like to do it the hard way so that i can learn stuffs better - It would be nice if you can show me some pointers to some tutorial apps and open source code which does similar tasks.

  2. Once I have identified and connected to the device. I should be able to start a chat with the device.

    Assume the second device is also an android device, how can I establish basic message sending from one android device to another.

Basically my app will be a client and server (I guess 2 services - service listening to sockets for incoming messages and client can send out messages).

Does anyone know开发者_如何转开发 any sample app / tutorials [basically code examples] which does this in android.


To Nr.1

I'm not quite sure why you first need to ping the device, as you could simply try to connect to the given device (using a timeout) and see if it can be connected.

I found some informations on this, here.

To Nr.2

So, if you want your Devices to communicate to each other, you'll want to use Sockets.

But, if your App is only for chatting and you don't need to know if the last send package was successfully send, you could also use UDP instead of TCP (So you don't need your application to run both the Server and the Client-Socket).

Although, all your questions could have been answered by doing a little googleing...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜