1

I have a code that sends UDP messages. The UDP server is a raspberry pi with python code. I have an access point enabled on the pi. My Laptop is connected to this network from the pi, also my phone where I debug the code. If the access point is not enabled everything works fine. The phone sends UDP messages to the raspi and raspi receives them. However, if the access point is enabled, raspi doesn't receive UDP messages. The interesting thing is: If I debug on an emulator, it does work. Of course, I changed the IP when Access Point is enabled and the IP seems to be right because it does work with an emulator. But not with my real phone. I am using unicast (i think). What do I have to do to make it work on the real phone?

Here is the code of the UDP in flutter:

int serverPort = 5000;
  InternetAddress serverAddress = InternetAddress("192.168.4.255");

  void sendvalue(int jf) {
    RawDatagramSocket.bind(InternetAddress.anyIPv4, 5000).then((socket) {
      socket.send(
          const Utf8Codec().encode(jf.toString()), serverAddress, serverPort);
    });
  }
Gwhyyy
  • 7,554
  • 3
  • 8
  • 35
Max
  • 11
  • 2

0 Answers0