1 Reply Latest reply on Jul 16, 2018 1:49 PM by Robin West

    SGD commands - specifically getvar

    Mike Roosa

      I wrote a simple Go program to connect to the printer, run an a command


      ! U1 getvar "zpl.system_status"\r\n


      I was then trying to read the response but my read listener kept timing out.  I was expecting a \n at the end of the data coming from the printer but was not getting it. Is there a way to tell the printer to respond and terminate the line with \n?


      If not, what's the best way to listen for a response. I ended up reading the stream and then setting a timeout to wait for more data, but that seems kind of hacky.


      Is there a specific character I can wait for to indicate the printer is done sending the response?


      I also logged in with a telnet client manually and saw the same behavior.

        • Re: SGD commands - specifically getvar
          Robin West

          Hi Mike, You are correct that the SGD commands do not have a end character, just double quotes to start and end.  This is default behavior for SGD commands.  If you are using a newer (Link-OS) printer, you can send the SGD as a JSON string and the response is also in JSON:


          will respond with:


          So you can take the '}' as the end character.  Also it's easier to parse and you always know the response is for the SGD you have requested if you are requesting multiple.

          1 of 1 people found this helpful