OK, i'm not going to bother posting what i've tried so far, since i've tried pretty much everything i could find (except for what would work for me).
Basicly, it's a client/server thing. The concept should be fairly simple. (pseudo)Code snippets of what i'm doing as follows:
use warnings; # Handy
use strict; # Even more handy
use IO::Socket::INET;
my $socket = IO::Socket::INET->new (
LocalPort => $config{'listenport'},
Proto => 'udp',
Reuse => 1,
) or die "Can't create listening socket: $@\n";
while (1)
{
my $indata;
# Read some data from the serial port
# Read some data from a few files
# ~300 lines of calculations go here, putting it all into $out
+data when done
shipout($outdata);
# flush buffers, and other stuff
}
sub shipout
{
my $datatoship = shift;
# these lines should be replaced by something that
# that sends the contents of $datatoship to
# everyone (or anyone) that is connected to $socket
# if none is connected, just move on.
}
__END__
So, yeah.. basicly, I need to send the result of the calculations done in the mainloop to anyone that might be connected to the socket. The communications are one-way, as in no clients ever sending anything to the server, as they just connect to read a stream of data calculated by the server. I have looked at many examples, but i have still not found one that deals with one-way comms, except from client->server, and i need it the other way around. I thought this should be fairly straightforward, and i still do, i'm just sure that i'm missing something very vital.