TCP/IP Socket Communications

In communicating with a label print server I have the option of triggering it via a TCP/IP socket connection. What’s the best way to go about this.

I’ve added a TCP/IP device and that seems to be working. Now the print server is expecting a string of comma delimited data that it will use. I’ve tried creating a tag and writing to this but I always get errors.

def PrintTicket2 (LineIndex,PartIndex,PrnName): import system.tag OutputData = '22,2222,82222,123,07/23/2012,9:22AM,1,ZZZZ,3,2121,Stuff,33,Other,44' system.tag.writeToTags('LabelSystemProvider.MoveTicketData.Value',OutputData)

This particular version tells me: [quote]TypeError: writeToTags(): 1st arg can’t be coerced to String[]
[/quote]

I’d prefer to do this via TCP as my alternative is communicating via text file.

If you look at the documentation for writeToTags you’ll notice that it’s expecting an array of tagpaths and an array of values. You’re passing in a single value for each of those. Put square brackets around them to make it an array:

def PrintTicket2 (LineIndex,PartIndex,PrnName):
   import system.tag
   OutputData = '22,2222,82222,123,07/23/2012,9:22AM,1,ZZZZ,3,2121,Stuff,33,Other,44'
   system.tag.writeToTags(['LabelSystemProvider.MoveTicketData.Value'],[OutputData])