Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mBuino_ENC28_MQTT Nucleo_Web_ENC28J60 Nucleo_Web_ENC28J60_ADC Serial_over_Ethernet ... more
Library for ENC28J60 Ethernet modules.

Ported to mbed from Norbert Truchsess's UIPEthernet library for Arduino. Thank you Norbert!
- Full support for persistent (streaming) TCP/IP and UDP connections Client and Server each, ARP, ICMP, DHCP and DNS.
- Works with both Mbed OS 2 and Mbed OS 5.
Usage:
- Import the library into your project.
- Add
#include "UipEthernet.h"tomain.cpp - Create one instance of the UipEthernet class initialized with the MAC address you'd like to use and SPI pins of the connected Mbed board.
Example programs:
Import programWebSwitch_ENC28J60
HTTP Server serving a simple webpage which enables to remotely turn a digital output on/off. Compile, download, run and type 'IP_address/secret/' (don't forget the last '/') into your web browser and hit ENTER.
Import programHTTPServer_Echo_ENC28J60
A simple HTTP server echoing received requests. Ethernet connection is over an ENC28J60 board. Usage: Type the server's IP address into you web browser and hit <ENTER>.
Import programTcpServer_ENC28J60
Simple TCP/IP Server using the UIPEthernet library for ENC28J60 Ethernet boards.
Import programTcpClient_ENC28J60
Simple TCP/IP Client using the UIPEthernet library for ENC28J60 Ethernet boards.
Import programUdpServer_ENC28J60
Simple UDP Server using the UIPEthernet library for ENC28J60 Ethernet boards.
Import programUdpClient_ENC28J60
Simple UDP Client using the UIPEthernet library for ENC28J60 Ethernet boards.
Import programMQTT_Hello_ENC28J60
MQTT Client example program. Ethernet connection is via an ENC28J60 module.
Diff: Dhcp.h
- Revision:
- 8:4acb22344932
- Parent:
- 0:5350a66d5279
--- a/Dhcp.h Tue Apr 26 18:37:14 2016 +0000
+++ b/Dhcp.h Fri Jun 30 19:51:28 2017 +0000
@@ -1,61 +1,61 @@
// DHCP Library v0.3 - April 25, 2009
// Author: Jordan Terrell - blog.jordanterrell.com
#ifndef Dhcp_h
- #define Dhcp_h
+#define Dhcp_h
- #include "UIPUdp.h"
+#include "UIPUdp.h"
/* DHCP state machine. */
- #define STATE_DHCP_START 0
- #define STATE_DHCP_DISCOVER 1
- #define STATE_DHCP_REQUEST 2
- #define STATE_DHCP_LEASED 3
- #define STATE_DHCP_REREQUEST 4
- #define STATE_DHCP_RELEASE 5
+#define STATE_DHCP_START 0
+#define STATE_DHCP_DISCOVER 1
+#define STATE_DHCP_REQUEST 2
+#define STATE_DHCP_LEASED 3
+#define STATE_DHCP_REREQUEST 4
+#define STATE_DHCP_RELEASE 5
- #define DHCP_FLAGSBROADCAST 0x8000
+#define DHCP_FLAGSBROADCAST 0x8000
/* UDP port numbers for DHCP */
- #define DHCP_SERVER_PORT 67 /* from server to client */
+#define DHCP_SERVER_PORT 67 /* from server to client */
- #define DHCP_CLIENT_PORT 68 /* from client to server */
+#define DHCP_CLIENT_PORT 68 /* from client to server */
/* DHCP message OP code */
- #define DHCP_BOOTREQUEST 1
- #define DHCP_BOOTREPLY 2
+#define DHCP_BOOTREQUEST 1
+#define DHCP_BOOTREPLY 2
/* DHCP message type */
- #define DHCP_DISCOVER 1
- #define DHCP_OFFER 2
- #define DHCP_REQUEST 3
- #define DHCP_DECLINE 4
- #define DHCP_ACK 5
- #define DHCP_NAK 6
- #define DHCP_RELEASE 7
- #define DHCP_INFORM 8
+#define DHCP_DISCOVER 1
+#define DHCP_OFFER 2
+#define DHCP_REQUEST 3
+#define DHCP_DECLINE 4
+#define DHCP_ACK 5
+#define DHCP_NAK 6
+#define DHCP_RELEASE 7
+#define DHCP_INFORM 8
- #define DHCP_HTYPE10MB 1
- #define DHCP_HTYPE100MB 2
+#define DHCP_HTYPE10MB 1
+#define DHCP_HTYPE100MB 2
- #define DHCP_HLENETHERNET 6
- #define DHCP_HOPS 0
- #define DHCP_SECS 0
+#define DHCP_HLENETHERNET 6
+#define DHCP_HOPS 0
+#define DHCP_SECS 0
- #define MAGIC_COOKIE 0x63825363
- #define MAX_DHCP_OPT 16
+#define MAGIC_COOKIE 0x63825363
+#define MAX_DHCP_OPT 16
- #define HOST_NAME "ENC28J"
- #define DEFAULT_LEASE (900) //default lease time in seconds
+#define HOST_NAME "ENC28J"
+#define DEFAULT_LEASE (900) //default lease time in seconds
- #define DHCP_CHECK_NONE (0)
- #define DHCP_CHECK_RENEW_FAIL (1)
- #define DHCP_CHECK_RENEW_OK (2)
- #define DHCP_CHECK_REBIND_FAIL (3)
- #define DHCP_CHECK_REBIND_OK (4)
+#define DHCP_CHECK_NONE (0)
+#define DHCP_CHECK_RENEW_FAIL (1)
+#define DHCP_CHECK_RENEW_OK (2)
+#define DHCP_CHECK_REBIND_FAIL (3)
+#define DHCP_CHECK_REBIND_OK (4)
enum
{
