{"id":297,"date":"2010-11-12T00:30:17","date_gmt":"2010-11-12T05:30:17","guid":{"rendered":"http:\/\/www.virtualroadside.com\/blog\/?p=297"},"modified":"2010-11-12T00:33:02","modified_gmt":"2010-11-12T05:33:02","slug":"crio-netconsole-implemented-in-python","status":"publish","type":"post","link":"http:\/\/www.virtualroadside.com\/blog\/index.php\/2010\/11\/12\/crio-netconsole-implemented-in-python\/","title":{"rendered":"cRio Netconsole implemented in Python"},"content":{"rendered":"<p>The FIRST Robotics Competition uses the NI-cRio platform for the controller for the robots in the competition. There is a bit of functionality called &#8216;NetConsole&#8217; which sends the stdout from vxWorks out to a waiting client (refer to the <a href=\"http:\/\/first.wpi.edu\/FRC\/frccupdates.html\">WPI FIRST website<\/a> for instructions to enable this). It turns out that the protocol used to implement the NetConsole for the cRio is incredibly simple&#8230; it just sends the raw output data as a bunch of UDP packets out to the broadcast address on port 6666 (which I suppose is slightly amusing). Here&#8217;s a dirt-simple python script that catches the output (TODO: need to send it input&#8230; haven&#8217;t gotten around to looking at that yet). <\/p>\n<pre>\r\n#!\/usr\/bin\/env python\r\n\r\nimport socket\r\nimport select\r\n\r\nUDP_PORT=6666\r\n\r\nsock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP )\r\n\r\nsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\r\nsock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)\r\nsock.bind( ('',UDP_PORT) )\r\nsock.setblocking(0)\r\n\r\nwhile True:\r\n    result = select.select( [sock], [], [] )\r\n    msg = result[0][0].recv( 8196 )\r\n    print msg\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The FIRST Robotics Competition uses the NI-cRio platform for the controller for the robots in the competition. There is a bit of functionality called &#8216;NetConsole&#8217; which sends the stdout from vxWorks out to a waiting client (refer to the WPI FIRST website for instructions to enable this). It turns out that the protocol used to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41,1,45],"tags":[],"_links":{"self":[{"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/297"}],"collection":[{"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=297"}],"version-history":[{"count":6,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":302,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/297\/revisions\/302"}],"wp:attachment":[{"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}