Modbus TCP Slave via dynamic DNS

tcave42
2 days ago
1 day ago
  • tcave42

    tcave42 - 2 days ago

    Is it possible to run an Modbus TCP connection to a device that is offsite on a different network via a dynamic DNS like for example DuckDNS?

     
  • i-campbell

    i-campbell - 2 days ago

    In Library Manager, add the Net Base Services library.
    In your program declare a variable of type NBS.ResolveHostname
    Call this instance to resolve the hostname.

     

    Last edit: i-campbell 2 days ago
    • tcave42

      tcave42 - 2 days ago

      thank you for your reply, I'm still not having any luck, could you make an example?

       
      • i-campbell

        i-campbell - 1 day ago
        PROGRAM PLC_PRG
        VAR
            instResolveHostname : NBS.ResolveHostname;
            xResolved: BOOL;
            xResolve: BOOL;
            myIP: NBS.IPv4Address;
            myIPInterface : NBS.IIPAddress := myIP;
            TheIPYouAreLookingFor: UDINT;
        END_VAR
        
        instResolveHostname(
            xExecute:= xResolve, 
            udiTimeOut:= 10_000_000, //10sec timeout
            xDone=> xResolved, 
            sHostname:= 'www.codesys.com', 
            itfIPAddress:= myIPInterface
            );
        
        TheIPYouAreLookingFor := myIP._udiIPAddress;
        
         

Log in to post a comment.