# TCP/IP Socket Communications

**URL:** <https://forum.inductiveautomation.com/t/tcp-ip-socket-communications/4886>\
**Category:** General Discussion\
**Created:** [July 25, 2012, 8:25pm UTC](https://forum.inductiveautomation.com/t/tcp-ip-socket-communications/4886 "2012-07-25T20:25:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [July 25, 2012, 8:25pm UTC](https://forum.inductiveautomation.com/t/tcp-ip-socket-communications/4886/1 "2012-07-25T20:25:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 25, 2012, 8:33pm UTC](https://forum.inductiveautomation.com/t/tcp-ip-socket-communications/4886/2 "2012-07-25T20:33:08Z")

</div>

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:

```auto
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])
```
