Search code examples
androidnetwork-programmingudpandroid-wifilan

Pass data from android phone(WiFi) to PC(LAN)


I need pass data(string) from my mobile that connected using WiFi to my computer that connected using LAN. How can I do it in Android ? WiFi and LAN are in same network.

Thanks

Edit I have to use UDP. Stream video using UDP.


Solution

  • Establish a socket connection between the two devices and then use that connection to send data. One device should work as a server and the other as a client. Don't forget to add the right permission to the Android manifest:

    <uses-permission android:name="android.permission.INTERNET" /> 
    

    Read about a socket connection here:

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