Reference   Language | Libraries | Comparison | Changes

Ethernet

Ethernet.subnetMask()

Description

Returns the subnet mask of the device.

Syntax

Ethernet.subnetMask()

Parameters

none

Returns

the subnet mask of the device (IPAddress)

Example

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Ethernet.begin(mac, ip);

  Serial.print("The subnet mask is: ");
  Serial.println(Ethernet.subnetMask());
}

void loop () {}

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.