Connect two Android devices via router

how to find list of devices connected to my wifi in android programmatically
how to connect 2 devices on same wifi network
android wifi direct create group example
wifi p2p android
how to enable p2p in android
android peer-to-peer communication over internet
wifi p2p android example
p2p android app

I want to send data from one Android device to another Android device which are connected to same router via wifi? Same App is installed on both devices and i want them to communicate each other connected to same router via wifi.

Use socket connection with any of these protocols UDP, TCP or HTTP

Send message using UDP

String messageStr="Hello Android!";
int server_port = 12345;
DatagramSocket s = new DatagramSocket();
InetAddress local = InetAddress.getByName("");
int msg_length=messageStr.length();
byte[] message = messageStr.getBytes();
DatagramPacket p = new DatagramPacket(message,msg_length, local,server_port);

Receive UDP message

String text;
int server_port = 12345;
byte[] message = new byte[1500];
DatagramPacket p = new DatagramPacket(message, message.length);
DatagramSocket s = new DatagramSocket(server_port);
text = new String(message, 0, p.getLength());
Log.d("Udp tutorial","message:" + text);

Connect devices wirelessly, The addition of Network Service Discovery (NSD) takes this further by allowing an application to seek out a nearby device running services with� This class also shows you how to use NSD and Wi-Fi P2P in combination to detect the services offered by a device and connect to the device when neither device is connected to a network. If you're looking for a higher-level API for your Android application to transfer data reliably and securely between devices using a combination of Wi-Fi and

I'm also interested in this (sending data between two devices on a wireless network connection without internet), so I did a quick search and found another answer below.

Android - communicating between two devices

Android Wireless API will also work if your devices are on the same local network (i.e., use the same WiFi router)

Create P2P connections with Wi-Fi Direct, In cases where multiple devices are going to be connected to a single device ( like a game with three or more players, or a chat app), one device� If a wireless LAN router is connected to the network connected to the machine, you can establish a communication with a mobile device via the wireless LAN router in the same way for a computer. For information about how to connect a mobile device to your wireless LAN router, see the instruction manuals for your networking devices or contact

Sockets are the way to accomplish this.

You'll need a way to discover the ip address and port of the socket you want to connect to. You can use Android network service discovery.

You can find a complete tutorial of how to build an app like this here

Share a mobile connection by hotspot or tethering on Android , You can use your phone's mobile data to connect another phone, tablet or computer to the Internet. Sharing a connection this way is called tethering or using a� How to Connect Windows 10 and Android Using Microsoft's 'Your Phone' App. Microsoft is eager to tie your Windows PC to your smartphone. With the October 2018 Update and above, the 'Your Phone' app

Connecting devices using Wi-Fi Direct, 1 Open Settings on you device and Select Wi-Fi. 2 Tap Wi-Fi Direct. 3 Locate and select the device you would like to connect to. 4 The other device will receive an Invitation to connect , Tap Accept for the connection to be made. Step 4) Now, prior to check the device, user have to connect an external Android device (mobile phone). To connect use the device USB cable connector to the system. Then in above command prompt type command- 'adb devices' & press Enter. It will display all list of all the connected devices. But, prior to this we should check that ADB server.

How to use your phone's Wi-Fi connection on multiple devices , Have you managed to connect your phone's internet connection with other devices? Tell us in the comments. Tips & Tricks Android for Beginners. From this point on, router #1 will be called ‘Primary’ and router #2 will be referred to as the ‘Secondary’ or ‘client’ router. Option #1: Connect Two Routers. With option #1, you connect the LAN port of the client router to the LAN port of the primary router (do not use the WAN port on the client router).

How to connect a wireless router using an Android phone, Mainly there are two IP address for router setup, one is and another is you will able to access your wireless router from your Android phone. Some VoIP phones offer an Ethernet pass-through option. This allows you to connect another device, such as a computer, to your phone so that you only need to use one port on your router to connect two devices. If you wish to use this option, connect your computer's Ethernet cable to the port on the base station that says "PC" or something similar.

  • Possible duplicate of Android - communicating between two devices
  • @FlorianKoch we have make use of Wi-Fi Peer-to-Peer?
  • please clarify, I'm not sure what you mean. The answers of the other question also include information regarding connection via a router, not only direct, see this answer
  • please don't answer only with links. Looking at your Link, the question seems like a duplicate - this means this question should be marked as duplicate instead of beeing answered (I know you can't do that just yet)