Home | News | Products | Support | Download | Sales | library | Guests | Contact | WebCam | Links
CDS Logo LanBox-Talk mail archive
 

By date: Prev | Next | Index By thread: Prev | Next | Index

SubjectRe: [LCtalk] Socket Control disconnect
FromMatthijs van Duin
DateThu, 19 Aug 2004 22:14:10 +0200


On Thu, Aug 19, 2004 at 01:36:28PM -0500, Hal Eagar wrote:
I'm using the LCE as a ethernet->DMX interface, for which is works great. but if I don't send a message for about a minut it seems to disconnect me. My client is a simple PERL script.
I'm going to add some more error checking right now but I wondered; Is this expected, what is the timeout, and is there a prefered ping message?

The idle-timeout is 5 minutes, the preferred ping is the Set16bitMode message (with as argument whether you want 8-bit or 16-bit mode).


However, if you're just using it as simple ethernet->DMX interface, why not use UDP instead? Easier, much faster, and no timeouts. Something like:

use strict;
use warnings;
use IO::Socket::INET;
use Time::HiRes 'usleep';

use constant DEVICE => "192.168.1.77:4777";
use constant LAYER  => 254;  # mixer
use constant OFFSET => 1;    # start at channel 1

my $s = new IO::Socket::INET Proto => "udp", PeerAddr => DEVICE or die $@;

my @dmx = (0 .. 255, 0 .. 255);  # 512 values
my $seq = 0;

while () {
	### change @dmx here ###

	$s->send(pack "nnCCnnC*", 0xC0B7, ($seq &= 0xFFFF)++,
			0xCA, LAYER, 6 + @dmx, OFFSET, @dmx) or die $!;

	usleep 47000;  # wait 47ms
}


PS. "Perl" is not all-uppercase. :-)


--
Matthijs van Duin  --  May the Forth be with you!


By date: Prev | Next | Index By thread: Prev | Next | Index