Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (5)
    As of 2024-07-13 03:30 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?
      erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.