Reference   Language | Libraries | Comparison | Changes

WiFiNINA : UDP class

beginMulticast()

Description

Initializes the WiFi UDP library and network settings. Starts WiFiUDP socket, listening at local port PORT and on specified multicast IP address.

Syntax

WiFiUDP.beginMulticast(IPAddressport, port);

Parameters

IPAddress: sdd
port: the local port to listen on (int)

Returns

1: if successful
0: if there are no sockets available to use

Example


WiFiUDP udp;
void setup() {
  Serial.begin(9600);
  while (!Serial) {
        ;
  }

  if (WiFi.status() == WL_NO_MODULE) {
        Serial.println("Communication with WiFi module failed!");

        while (true);
  }

  while (status != WL_CONNECTED) {
        Serial.print("Attempting to connect to SSID: ");
        Serial.println(ssid);
        status = WiFi.begin(ssid, pass);

        // wait 10 seconds for connection:
        delay(10000);
  }
  Serial.println("Connected to wifi");
  printWifiStatus();

  Serial.println("\nStarting connection to server...");

  udp.beginMulticast(IPAddress(226, 1, 1, 1), 4096);
  Serial.println("\n connected udp multicast");



!!!!See Also


Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.