Checking Ethernet Status

Top  Previous  Next

The net.failure read-only property tells you if the NIC is functioning properly.

The net.linkstate read-only property tells you if there is a live Ethernet cable plugged into the Ethernet port of your device, and, if yes, whether this is a 10BaseT or 100BaseT connection. The on_net_link_change event is generated each time the link status changes:

 

 

sub on_net_link_change

 

 if net.linkstate= PL_NET_LINKSTATE_NOLINK then

               'switch the RED LED on (just an example of what you could do)

         pat.play("RRRRRRRRRRRRRRRR", YES)

 else

         'switch the GREEN LED on

         pat.play("GGGGGGGGGGGGGGGG", YES)

 end if

 

end sub

 

 

Notice, that the net.linkstate always reflects current link status, not the link at the time of event generation.

Finally, there is a on_net_overrun event that is generated when internal RX buffer of NIC overflows.