View Full Version : Simple Transport to send ASCII to an IP socket

August 18th, 2012, 12:39 AM
I need some asistance with a simple Transport lua to send ASCII strings to my multizone amplifier.

I can use a simple script as follows to turn on Zone 2 for example;

local socket = gip.Open('',9621)
if socket then
socket:Write ('EVENT C[1].Z[2]!ZoneOn \r')

I haven't been able to build a Transport to send the same string (EVENT C[1].Z[2]!ZoneOn) via an Action (I've tried modifying the Tutorial files). Any assistance ia appreciated.

August 21st, 2012, 07:00 PM
It's probably a good idea to build upon the transport structure not the GIP structure. There are a few examples in the manual. Basically what is going wrong here is that GIP and transport are asynchronous. This means that even though you get a socket it's actually not yet connected. Check out the examples on how to catch the connect.

August 22nd, 2012, 07:23 AM
Thanks Ron

When you say "the examples on how to catch the connect" are you referring to the Transport tutorials in section 7.6? That's what I've been trying to modify without success - GC Tutorial 1 (and 2).

August 22nd, 2012, 07:54 AM
That's the ones. Post what you have so far...

August 22nd, 2012, 07:48 PM
I've tried a few different things - attached is the Transport that I've had some success with (modified version of mysimple from Shaun5).

I can use it successfully with the following script but I can't use it to send the same string in a Transport Send.

local txManager = ComponentManager:GetComponentUsingName('Transport Manager')
local tp = txManager:GetTransportUsingName('My mysimple_MCA-C5')
tp:Send('EVENT C[1].Z[2]!ZoneOn\r');