In OptoScript, is it possible to use a DNS instead of an IP address to create a communication handle. I have been trying it. So far, it is not working.
I am trying to send data across using tcp as described on the internetio.com site:
str_php_ip = "vm-ks-dev.dckbengineering.local"; //This is the IP address/DNS of the web server that will be receiving the data. str_php_port = "80"; //This is the prot of the web server. str_php_handle = "tcp:" + str_php_ip + ":" + str_php_port; SetCommunicationHandleValue(str_php_handle, com_php_handle); FloatToString(flt_engineering_unit, 10,3, str_engineering_unit); while (GetNthCharacter(str_engineering_unit, 0) == ' ') GetSubstring(str_engineering_unit, 1, GetStringLength(str_engineering_unit), str_engineering_unit); wend //str_watch_string = str_engineering_unit; str_php_url = "POST http://" + str_php_ip + "/opto_test/test.php?ip_address=" + str_ip_address + "&" + str_tag_name + "=" + str_engineering_unit; //str_watch_string = str_php_url; // Now append a CR+LF, your browser normally does this for you, the Apache web server expects it so it knows the URL is done. str_php_url += chr(13); //append CR str_php_url += chr(10); //append LF int_trash_can = OpenOutgoingCommunication(com_php_handle); // Slight pause while we wait for the network and webserver to respond. Make it longer for slower networks DelayMsec (100); int_trash_can = TransmitString(str_php_url, com_php_handle); // Close the handle so we can do it all again when required. // Note, Apache will close the IP session now regardless, thus you can ONLY SEND one string per session. // So if you want to send, say, three bits of info to three different PHP scrips, you will need to use three different com handles! int_trash_can = CloseCommunication(com_php_handle);
It works when I use the IP address, but not with the DNS.