<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SCPI on a Linux Board - Part 3: TCP/IP Socket C++ programming</title><link>/technologies/test-and-measurement/b/blog/posts/scpi-on-a-linux-board---part-3-tcp-ip-socket-c-programming</link><description>I&amp;#39;m building a SCPI electronics lab instrument for Linux.This post is an object oriented one again: testing if I can create a stream-like socket server in C++.TL;DR yes If you are interested in object oriented design, you may want to stay and read...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: SCPI on a Linux Board - Part 3: TCP/IP Socket C++ programming</title><link>https://community.element14.com/technologies/test-and-measurement/b/blog/posts/scpi-on-a-linux-board---part-3-tcp-ip-socket-c-programming</link><pubDate>Fri, 20 Jul 2018 18:31:23 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:2c93c915-7a23-4dfa-bc7e-72189007d0ab</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I advanced on this design. The SCPI Parser and the Instrument can now both run and interact. Both act as a TCP/IP server.&lt;/p&gt;&lt;p&gt;When you send a SCPI command to the SCPI parser over the network, it interprets the command, and sends it over another port to the Instrument service. Then it sends any response back as a SCPI reply over the network.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;It doesn&amp;#39;t sound spectacular, but there are a few things that I wanted to try out and that work:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The SCPI parser is a C linux program that runs both as a TCP/IP socket server and client.&lt;/p&gt;&lt;p&gt;It&amp;#39;s a server for SCPI commands, and a client that connects to the Instrument server to let that one physically execute the desired commands.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The Instrument is a C++ linux program that runs as a TCP/IP socket server and listens for actions. It acts on them and replies synchronously via the same socket.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This setup allows me to mix C and C++, split the SCPI part from the instrument API, allows for security needs on the SCPI arser only and allows the 2 programs to be executed as daemons - in a different security space than any other user.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=5021&amp;AppID=13&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: SCPI on a Linux Board - Part 3: TCP/IP Socket C++ programming</title><link>https://community.element14.com/technologies/test-and-measurement/b/blog/posts/scpi-on-a-linux-board---part-3-tcp-ip-socket-c-programming</link><pubDate>Sun, 24 Jun 2018 19:46:27 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:2c93c915-7a23-4dfa-bc7e-72189007d0ab</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;For a synchronuous interaction, this is the code:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:3ef06e6b-9b7d-4651-b12d-db8be7f5e991:type=c_cpp&amp;amp;text=++++++std%3A%3Astring+x%3B%0A++++++acceptor.accept%28*stream.rdbuf%28%29%29%3B%0A++++++while+%28stream+%3E%3E+x%29+%7B%0A++++++++stream+%3C%3C+%22You+said%3A+%22+%3C%3C+x+%3C%3C+std%3A%3Aendl%3B%0A++++++%7D]&lt;/p&gt;&lt;div&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;[View:/resized-image/__size/428x116/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-2c93c915-7a23-4dfa-bc7e-72189007d0ab/contentimage_5F00_206700.png:428:116]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;There would be logic between the stream &amp;gt;&amp;gt; and stream &amp;lt;&amp;lt; lines to deal with the incoming traffic and reply.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=5021&amp;AppID=13&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: SCPI on a Linux Board - Part 3: TCP/IP Socket C++ programming</title><link>https://community.element14.com/technologies/test-and-measurement/b/blog/posts/scpi-on-a-linux-board---part-3-tcp-ip-socket-c-programming</link><pubDate>Sun, 24 Jun 2018 17:31:36 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:2c93c915-7a23-4dfa-bc7e-72189007d0ab</guid><dc:creator>DAB</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Nice update.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;DAB&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=5021&amp;AppID=13&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>