Stripped down version of Segundos NetService library (http://mbed.org/users/segundo/libraries/NetServices ). I have removed all NetServices, and all functions which had been disabled. Use this version when you need only pure TCP or UDP functions - this library compiles faster.

Dependencies:   lwip lwip-sys

Dependents:   christmasLights device_server pop3demo device_server_udp ... more

Embed: (wiki syntax)

« Back to documentation index

EthernetNetIf Class Reference

EthernetNetIf Class Reference

Ethernet network interface. More...

#include <EthernetNetIf.h>

Inherits LwipNetIf.

Public Member Functions

 EthernetNetIf (const char *hostname=NULL)
 Instantiates the Interface and register it against the stack, DHCP will be used.
 EthernetNetIf (IpAddr ip, IpAddr netmask, IpAddr gateway, IpAddr dns)
 Instantiates the Interface and register it against the stack, DHCP will not be used.
EthernetErr setup (int timeout_ms=15000)
 Brings the interface up.
const char * getHwAddr () const
 Returns an array containing the hardware address.
const char * getHostname () const
 Returns a pointer to the hostname set in the constructor.
IpAddr getIp () const
 Returns the IP of the interface once it's connected.

Detailed Description

Ethernet network interface.

This class provides Ethernet connectivity to the stack

Definition at line 50 of file EthernetNetIf.h.


Constructor & Destructor Documentation

EthernetNetIf ( const char *  hostname = NULL )

Instantiates the Interface and register it against the stack, DHCP will be used.

An optional hostname can be specified which will be passed to the DHCP server. Examples without and with hostname specified:

 EthernetNetIf eth();
 EthernetNetIf eth("mbedSE");

Definition at line 40 of file EthernetNetIf.cpp.

EthernetNetIf ( IpAddr  ip,
IpAddr  netmask,
IpAddr  gateway,
IpAddr  dns 
)

Instantiates the Interface and register it against the stack, DHCP will not be used.

IpAddr is a container class that can be constructed with either 4 bytes or no parameters for a null IP address.

Definition at line 50 of file EthernetNetIf.cpp.


Member Function Documentation

const char * getHostname (  ) const

Returns a pointer to the hostname set in the constructor.

Definition at line 192 of file EthernetNetIf.cpp.

const char * getHwAddr (  ) const

Returns an array containing the hardware address.

Definition at line 188 of file EthernetNetIf.cpp.

IpAddr getIp (  ) const [inherited]

Returns the IP of the interface once it's connected.

Definition at line 40 of file netif.cpp.

EthernetErr setup ( int  timeout_ms = 15000 )

Brings the interface up.

Uses DHCP if necessary

Parameters:
timeout_ms: You can set the timeout parameter in milliseconds, if not it defaults to 15s
Returns:
: ETH_OK on success or ETH_TIMEOUT on timeout

Definition at line 79 of file EthernetNetIf.cpp.