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.

In reply to UDP server with IO::Socket::INET by jarmund

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.