1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Detect Lan Connection

Discussion in 'T&T - Functions' started by Joe Caverly, Jul 28, 2010.

  1. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    730
    Likes Received:
    8
    No computer connected to the Internet, or any other TCP/IP compliant network, can identify itself as 127.0.0.1

    Thus;

    echo %@if[%_ip eq 127.0.0.1,0,1]

    function IsLan=`%@if[%_ip eq 127.0.0.1,0,1]`

    echo %@IsLan[]

    If @IsLan[] returns a 0, then you have no Lan connection.

    If @IsLan[] returns a 1, then you have a Lan connection.

    You can test this by issuing the IPCONFIG /release command to release the IP address for your adapter, and the IPCONFIG /renew command to renew the IP address for your adapter. (tested on XP).

    Joe
     

Share This Page