0

Most chat applications can run both server and client simultaneously, well in my case all I need is to connect all devices that uses my app to share data( gson object), in official documentation, I found direct WiFi connection (p2p) which doesn't work if the other device is not on local network, and socket ( server client separated ), which work only one way one device for sending and the other for receiving.

So does anyone have an example of connecting two or more devices trough internet by running both server and client socket in the same time.

Rahul Kadukar
  • 858
  • 3
  • 15
  • 35
Hamza Tahiri
  • 488
  • 3
  • 13
  • 'and socket ( server client separated ), which work only one way one device for sending and the other for receiving. '. Nonsense. Both server and client can of course send and receive. – greenapps Oct 17 '15 at 07:01
  • 'by running both server and client socket in the same time.'. In the same 'time'? What do you mean? And why 'in the same app' in your Subject? Very unclear what you want. – greenapps Oct 17 '15 at 07:04

1 Answers1

0

It's not so simple. The simplest is that each сleint create server. And every minute was looking for other servers on the local network. For example, sending a certain packet to a port.

Look about it here.

Then you will not care how customers relate to each other.

Community
  • 1
  • 1
user2413972
  • 1,355
  • 2
  • 9
  • 25