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:

Tibbo BASIC
sub on_sys_init
	... some other stuff	
 
	net.ip = "192.168.1.95" 'just an example! May not work on your network!
	net.gatewayip = "192.168.1.1" 'just an example! May not work on your network!
	net.netmask= "255.255.255.0" '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.