Net Object

Top  Previous  Next

object_net

The net. object of TiOS running on Tibbo hardware devices facilitates network communications via the hardware Ethernet port (if available).

The net. object of TiOS Simulator facilitates network communications via the WinPcap driver, which taps into the low-level network traffic of your PC's Ethernet port.

 

It is important to realize that, as far as net. and sock. objects are concerned, the Simulator does not rely on Windows sockets. TiOS has its own sockets implementation, so it requires a channel to receive and send MAC-level Ethernet packets into and out of its own socket system. This channel is provided by the WinPcap driver.

 

Several important points follow from the use of the WinPcap driver:

The net. object is fully separated from the socket system of your Windows PC. You can (and should) give your Simulator an IP address that is different from your PC's IP. The Simulator's ports are not integrated into the port space of your PC. From the Simulator's point of view, you PC is only a shell that lugs MAC-level Ethernet packets to and from the Simulator, with the help of the WinPcap driver.
The sock. object of the Simulator is only able to send and receive data when the WinPcap driver is enabled. This is achieved by checking the Use WinPcap checkbox and selecting the correct Ethernet interface in the Simulator's Options Dialog  (Simulator > Settings). This should be the Ethernet interface through which the Simulator's PC is connected to the network. You must have this PC connected to the network via the Ethernet interface. Using other interfaces, such as Wi-Fi, will prevent the net. and sock. objects from working correctly.
It is not possible to communicate with the sock. object from the same PC on which the Simulator is running. This is because the PC's internal network traffic goes through the loopback interface of Windows sockets. In other words, the Ethernet port that the WinPcap driver is attached to does not see any local (unicast) traffic. Hence, the Simulator won't receive any (unicast) network traffic originating from the same PC.

 

For more information see Network Communications on the Simulator.

 

Differences from the "real" net. object:

 

net.mac

Always equal to the MAC address of the host PC. The MAC cannot be changed even using the Change MAC feature of the Device Explorer.

net.failure

Always returns 0- NO.

net.linkstate

On each Simulator's (re-)start, changes from 0- PL_NET_LINKSTAT_NOLINK to 2- PL_NET_LINKSTAT_100BASET, regardless of the actual state of the Ethernet link.

on_net_link_change

Always happens once after the Simulator (re-)starts.

on_net_overrun

Never happens.

 

All other aspects of the net. object follow our "real" net. object found on several Tibbo devices.