Then don't use -r option, just run agent as a service. Make sure server can connect on port 4700 (agent installer should add firewall exception). You can use nxget on NetXMS server to test connection. If it returns error 408 (timeout), then it's likely firewall issue. If it is error 500 (or other 5xx) then most likely source address of incoming connection is not listed in MasterServers.
Best regards,
Victor
Best regards,
Victor