{"id":360,"date":"2020-03-30T20:13:10","date_gmt":"2020-03-31T01:13:10","guid":{"rendered":"https:\/\/sundrysites.com\/?page_id=360"},"modified":"2020-03-30T20:13:10","modified_gmt":"2020-03-31T01:13:10","slug":"move-packets-from-hca-to-arduino","status":"publish","type":"page","link":"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/move-packets-from-hca-to-arduino\/","title":{"rendered":"Move Packets from HCA to Arduino"},"content":{"rendered":"\n<p>This Perl program is called by HCA, using three parameters to format and send a packet to the appropriate Arduino.&nbsp; The 3 parameters are command, IP address and data.&nbsp; HCA sends them in that order as flags ardcmd1, ardaddr1 and arddata1 respectively.&nbsp; See <a href=\"http:\/\/homeautomationprojects.org\/?page_id=220\">this posting<\/a> for more information.<\/p>\n\n\n\n<p>use IO::Socket::INET;<br>use Getopt::Long;&nbsp; #pick up parms<\/p>\n\n\n\n<p>my $cmdIn = sprintf(&#8220;%.0f&#8221;,$ARGV[0]);<br>my $addrOut = $ARGV[1];<br>my $dataIn = sprintf(&#8220;%.0f&#8221;,$ARGV[2]);<\/p>\n\n\n\n<p>my $dataOut = $cmdIn . $dataIn;<br># print &#8220;$cmdOut\\n&#8221;;<br># print &#8220;$addrOut\\n&#8221;;<br># flush after every write<br># $| = 1;<br># my $dot68 = &#8220;192.168.0.68&#8221;;<\/p>\n\n\n\n<p>#&nbsp; we call IO::Socket::INET-&gt;new() to create the UDP Socket and bound<br># to specific port number mentioned in LocalPort and there is no need to<br># provide LocalAddr explicitly as in TCPServer.<br>my $socket = new IO::Socket::INET (<br>LocalPort =&gt; 6001,<br>Proto =&gt; &#8216;udp&#8217;,<br>PeerPort =&gt; 5001,<br>PeerAddr =&gt; $addrOut,<br>) or die &#8220;ERROR in Socket Creation : $!\\n&#8221;;<\/p>\n\n\n\n<p># read operation on the socket<br># $socket-&gt;recv($received_data,1024);<\/p>\n\n\n\n<p># get the peerhost and peerport at which the recent data received.<br># $peer_address = $socket-&gt;peerhost();<br># $peer_port = $socket-&gt;peerport();<br># print &#8220;\\n($peer_address , $peer_port) said : $received_data&#8221;;<\/p>\n\n\n\n<p>#send the data to the arduino.<br># $data = &#8216;1&#8217;;<br>print $socket &#8220;$dataOut&#8221;;<\/p>\n\n\n\n<p>$socket-&gt;close();<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This Perl program is called by HCA, using three parameters to format and send a packet to the appropriate Arduino.&nbsp; The 3 parameters are command, IP address and data.&nbsp; HCA sends them in that order as flags ardcmd1, ardaddr1 and arddata1 respectively.&nbsp; See this posting for more information. use IO::Socket::INET;use Getopt::Long;&nbsp; #pick up parms my &hellip; <a href=\"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/move-packets-from-hca-to-arduino\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Move Packets from HCA to Arduino<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":352,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-360","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Move Packets from HCA to Arduino - Sundrysites<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/move-packets-from-hca-to-arduino\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Move Packets from HCA to Arduino - Sundrysites\" \/>\n<meta property=\"og:description\" content=\"This Perl program is called by HCA, using three parameters to format and send a packet to the appropriate Arduino.&nbsp; The 3 parameters are command, IP address and data.&nbsp; HCA sends them in that order as flags ardcmd1, ardaddr1 and arddata1 respectively.&nbsp; See this posting for more information. use IO::Socket::INET;use Getopt::Long;&nbsp; #pick up parms my &hellip; Continue reading Move Packets from HCA to Arduino &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/move-packets-from-hca-to-arduino\/\" \/>\n<meta property=\"og:site_name\" content=\"Sundrysites\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sundrysites.com\\\/index.php\\\/home-info\\\/arduino-projects\\\/perl-programs\\\/move-packets-from-hca-to-arduino\\\/\",\"url\":\"https:\\\/\\\/sundrysites.com\\\/index.php\\\/home-info\\\/arduino-projects\\\/perl-programs\\\/move-packets-from-hca-to-arduino\\\/\",\"name\":\"Move Packets from HCA to Arduino - Sundrysites\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sundrysites.com\\\/#website\"},\"datePublished\":\"2020-03-31T01:13:10+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sundrysites.com\\\/index.php\\\/home-info\\\/arduino-projects\\\/perl-programs\\\/move-packets-from-hca-to-arduino\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sundrysites.com\\\/index.php\\\/home-info\\\/arduino-projects\\\/perl-programs\\\/move-packets-from-hca-to-arduino\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sundrysites.com\\\/index.php\\\/home-info\\\/arduino-projects\\\/perl-programs\\\/move-packets-from-hca-to-arduino\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sundrysites.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Home Info\",\"item\":\"https:\\\/\\\/sundrysites.com\\\/index.php\\\/home-info\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Arduino Projects\",\"item\":\"https:\\\/\\\/sundrysites.com\\\/index.php\\\/home-info\\\/arduino-projects\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Perl Programs\",\"item\":\"https:\\\/\\\/sundrysites.com\\\/index.php\\\/home-info\\\/arduino-projects\\\/perl-programs\\\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Move Packets from HCA to Arduino\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sundrysites.com\\\/#website\",\"url\":\"https:\\\/\\\/sundrysites.com\\\/\",\"name\":\"Sundrysites\",\"description\":\"As In Various and Sundry\",\"publisher\":{\"@id\":\"https:\\\/\\\/sundrysites.com\\\/#\\\/schema\\\/person\\\/1e11ce6af1587a3431e57dfc0797ab61\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sundrysites.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/sundrysites.com\\\/#\\\/schema\\\/person\\\/1e11ce6af1587a3431e57dfc0797ab61\",\"name\":\"Wayne Gulden\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c0392cdfb7826ed5407aad362998bc6dd03fe293560ce15ccc2211357e3cec6e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c0392cdfb7826ed5407aad362998bc6dd03fe293560ce15ccc2211357e3cec6e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c0392cdfb7826ed5407aad362998bc6dd03fe293560ce15ccc2211357e3cec6e?s=96&d=mm&r=g\",\"caption\":\"Wayne Gulden\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c0392cdfb7826ed5407aad362998bc6dd03fe293560ce15ccc2211357e3cec6e?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/sundrysites.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Move Packets from HCA to Arduino - Sundrysites","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/move-packets-from-hca-to-arduino\/","og_locale":"en_US","og_type":"article","og_title":"Move Packets from HCA to Arduino - Sundrysites","og_description":"This Perl program is called by HCA, using three parameters to format and send a packet to the appropriate Arduino.&nbsp; The 3 parameters are command, IP address and data.&nbsp; HCA sends them in that order as flags ardcmd1, ardaddr1 and arddata1 respectively.&nbsp; See this posting for more information. use IO::Socket::INET;use Getopt::Long;&nbsp; #pick up parms my &hellip; Continue reading Move Packets from HCA to Arduino &rarr;","og_url":"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/move-packets-from-hca-to-arduino\/","og_site_name":"Sundrysites","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/move-packets-from-hca-to-arduino\/","url":"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/move-packets-from-hca-to-arduino\/","name":"Move Packets from HCA to Arduino - Sundrysites","isPartOf":{"@id":"https:\/\/sundrysites.com\/#website"},"datePublished":"2020-03-31T01:13:10+00:00","breadcrumb":{"@id":"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/move-packets-from-hca-to-arduino\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/move-packets-from-hca-to-arduino\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/move-packets-from-hca-to-arduino\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sundrysites.com\/"},{"@type":"ListItem","position":2,"name":"Home Info","item":"https:\/\/sundrysites.com\/index.php\/home-info\/"},{"@type":"ListItem","position":3,"name":"Arduino Projects","item":"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/"},{"@type":"ListItem","position":4,"name":"Perl Programs","item":"https:\/\/sundrysites.com\/index.php\/home-info\/arduino-projects\/perl-programs\/"},{"@type":"ListItem","position":5,"name":"Move Packets from HCA to Arduino"}]},{"@type":"WebSite","@id":"https:\/\/sundrysites.com\/#website","url":"https:\/\/sundrysites.com\/","name":"Sundrysites","description":"As In Various and Sundry","publisher":{"@id":"https:\/\/sundrysites.com\/#\/schema\/person\/1e11ce6af1587a3431e57dfc0797ab61"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sundrysites.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/sundrysites.com\/#\/schema\/person\/1e11ce6af1587a3431e57dfc0797ab61","name":"Wayne Gulden","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c0392cdfb7826ed5407aad362998bc6dd03fe293560ce15ccc2211357e3cec6e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c0392cdfb7826ed5407aad362998bc6dd03fe293560ce15ccc2211357e3cec6e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c0392cdfb7826ed5407aad362998bc6dd03fe293560ce15ccc2211357e3cec6e?s=96&d=mm&r=g","caption":"Wayne Gulden"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/c0392cdfb7826ed5407aad362998bc6dd03fe293560ce15ccc2211357e3cec6e?s=96&d=mm&r=g"},"sameAs":["https:\/\/sundrysites.com"]}]}},"_links":{"self":[{"href":"https:\/\/sundrysites.com\/index.php\/wp-json\/wp\/v2\/pages\/360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sundrysites.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sundrysites.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sundrysites.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sundrysites.com\/index.php\/wp-json\/wp\/v2\/comments?post=360"}],"version-history":[{"count":1,"href":"https:\/\/sundrysites.com\/index.php\/wp-json\/wp\/v2\/pages\/360\/revisions"}],"predecessor-version":[{"id":361,"href":"https:\/\/sundrysites.com\/index.php\/wp-json\/wp\/v2\/pages\/360\/revisions\/361"}],"up":[{"embeddable":true,"href":"https:\/\/sundrysites.com\/index.php\/wp-json\/wp\/v2\/pages\/352"}],"wp:attachment":[{"href":"https:\/\/sundrysites.com\/index.php\/wp-json\/wp\/v2\/media?parent=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}