Internet PLC Forum
General => Technical support => Topic started by: Lorne Van Dusen on January 05, 2017, 12:43:14 PM
-
I am wondering if there is any way that the PLC can shown what Dynamic IP address it is given say from a router.
The PLC IP address was set as 0.0.0.0 in order to allow for a dynamic address.
So when you do a GET_IPAddr 100 of course you will see 0 0 0 0 9080
-
You just need to allow some time for the DHCP to work and then run the PRINT #4 "<IP>" command and use the INPUT$(4) to obtain the dynamic IP address assigned by the DHCP server.
One simple example is during initialization to wait for the IP address for up to 10 seconds:
FOR P = 1 to 10
PRINT #4 "<IP>" ' Get IP address of this FServer as a string
B$ = INPUT$(4)
IF LEN(B$) <> 0 AND STRCMP(B$,"0.0.0.0") <> 0
EXIT
ENDIF
DELAY 1000
NEXT
A$ = "IP=" + B$ + " "
SETLCD 1,1, A$
-
Thanks a lot
I just found this reply today I guess I forgot to check off to notify me.
I tried your example and it works perfectly.
What I needed this for is that I intend on providing our customers with physical disabilities a web app for their phone or tablet.
So to make life simple for our dealers I needed a simple way for them to find the assigned IP address which I now will show on one of the screens in the FP4020MR text display.
:D