Main Parameters

To enable Ethernet communications, you need to set the net.ip, net.gatewayip, and net.netmask properties. Actually, net.gatewayip and net.netmask are only needed when your device will be establishing outgoing connections to other hosts on the network (perform active opens). If your device will only be accepting incoming connections, then you do not have to set net.gatewayip and net.netmask.

A tip note icon.Strangely, a lot of people hold a passionate belief that default gateway IP and the netmask are necessary always, even for incoming connections. This is not true!

The net. object is usually initialized once on startup, like this:

sub on_sys_init
	... some other stuff	
	net.ip = "" 'just an example! May not work on your network!
	net.gatewayip = "" 'just an example! May not work on your network!
	net.netmask= "" 'just an example! May not work on your network!
	...some other stuff
end sub

A tip note icon.On a lot of networks, the IP address, gateway IP, and netmask parameters of the hosts are configured automatically through the use of a special protocol called "DHCP." The net. object does not support DHCP directly — we provide a Tibbo BASIC library that implements DHCP functionality.

One additional read-only property, net.mac, can be used to extract the MAC address of your device. Your program cannot change the MAC address directly. The MAC is stored in the special configuration area of the EEPROM. Access to the EEPROM is provided by the stor. object. To change the MAC address, you need to rewrite the data in the EEPROM. For more details, see the stor. object and the stor.base property.