java - Android devices connected with NSD, how to send messages using sockets (Client-Client)? -


i've setup p2p communication within app in couple of devices guide: http://developer.android.com/training/connect-devices-wirelessly/nsd.html

so, can find other devices in network thats running app. want send messages between clients. can 1,2 or more clients messages go 1 client @ time, more ping request text.

i've been reading sockets , seems way go (will communicate ios devices in nearby future). but.. in examples , tutorials found there server in group of clients messages go through. want send message client - - client.

basically want:

  1. list devices/clients in network running app, done! (is having ipadress, port etc of them)
  2. click 1 client , send ping/message

any hints or examples at? should client devices have "server" also?

regards, kristoffer

so figured out @ last.

i studying sockets little more in detail. ex:

http://docs.oracle.com/javase/tutorial/networking/sockets/clientserver.html

and realized needed server on clients work properly. clients have serversocket listening incoming connections , separate client socket sending messages these "servers".

it seems work connections both android , ios devices.

a couple of working examples using sockets:

http://examples.javacodegeeks.com/android/core/socket-core/android-socket-example/

http://thinkandroid.wordpress.com/2010/03/27/incorporating-socket-programming-into-your-applications/

/ kristoffer


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -