1

I will be creating an Android app to control the brightness of a LED. For this, I will want the Raspberry Pi and Android Phone to communicate with one another via Wifi. I don't need the RPI3 access point to be a working internet, as long as it allows the android to connect via wifi.

Steps to be involved (Correct me if I'm wrong):

  1. Set up Raspberry Pi as Access Point.
  2. Set up Raspberry Pi as TCP Server to listen for connections.
  3. Connect Android phone (TCP Client) to Raspberry Pi via wifi to the access point and send socket connection over.
  4. Send data from Android phone to Raspberry Pi.

I'm pretty much done with the Android App working as a client, however not sure about setting up the TCP server on the Raspberry Pi..

Is this what I am looking for? I do not need the RPI3 to be a wifi repeater or able to go to internet, all I want is to set it up as an access point. https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md

Are there any examples for setting up the TCP Server?

I am very new to this, please help!

1
  • You may want to consider wifi direct. en.wikipedia.org/wiki/Wi-Fi_Direct Sorry I have not used it so I can't give you my two cents but it seems to fit what you're trying to do. Commented May 5, 2017 at 5:03

2 Answers 2

2

I managed to do it.

Yes, I first set up the RPI as a standalone network wireless access point.

Then, I wrote a program in C to set up RPI as a TCP Server to listen for connections from my Android phone with the Geany ide.

Here is the tutorial I used to help me with the C programming. TCP Socket Tutorial

2
  • So you basically did what @Bex said you should do, yet didn't accept his answer.
    – user2497
    Commented Jun 13, 2017 at 14:40
  • @user2497 uhm, I didnt use netcat? I used the documentation in the Raspberry Pi website. And I coded my program in C, Linux on the RPI?
    – Marcus
    Commented Jun 14, 2017 at 1:20
0

The easiest way to set up a TCP listener on your Pi is probably to use netcat.

netcat -l -p 8080

makes netcat listen at port 8080. If you connect to that port from your Android device, you will see what is sent in the terminal on your Pi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.