http://www.perlmonks.org?node_id=806693


in reply to streaming of serial port data over ethernet

Hi,

Well, I think you should clarify a bit more what exactly you want to do, otherwise I can just say checkout Device::SerialPort, with this module you can read the serial port.

If you want to broadcast... what type of broadcast, do you want clients to connect to something (server) to get the data, polling/pushing?, you could use Spread, Jabber, ActiveMQ, maybe you want to use multicast IO::Socket::Multicast, in general you should read IO::Socket::INET.

Regards,

fmerges at irc.freenode.net
  • Comment on Re: streaming of serial port data over ethernet

Replies are listed 'Best First'.
Re^2: streaming of serial port data over ethernet
by amazon (Initiate) on Nov 12, 2009 at 12:58 UTC
    Hi, Thanks for the quick response, I think i was not able to put across the requirement properly. I have a device that gives output in NMEA 0183 format, which can be given to the serial port of a PC. Now, I want to transfer the NMEA information to another PC, connected to the first PC over Ethernet. So at the first PC data received over serial port is to be streamed out over Ethernet to the second PC, which should accept the information and display in cutecom.

      Hi,

      Ok, just read in wikipedia about this NMEA 0183, and it seems to be just one direction communication, from the device to listener(s), so I assume no commands are sent to the device to control it or change settings, right?

      This accept and display information in cutecom I would forget it, it even doesn't make sense anymore, as you're not connecting on the remote PC to a serial, instead you going to read on a socket to receive data.

      You can write a simple server using either TCP or UDP, and then the remote client connect to it to get pushed the telemetry data.

      For reading from the serial (via the module), you have to read data and split it in chunks or messages using the message delimiters of the protocol which are $ and &.

      If you want to make something more sophisticated you could think about writing the server using POE, so you would use the TCP server component and create a session that uses the code you write for reading from the serial. Or for example you could use something like spread, have a central server, and then have on each instrument you have a simple script that reads from serial and sends it to the Spread server, whoever wants to listen to that communication connects to the Spread server and reads from the channel(s).

      Using a TCP server you can use telnet to test it out, in case of Spread you can use spuser, in any case you can write a simple script that connects and read and dumps the data.

      What option fits best for you, is based on your requirements, also taking in mind, how many devices you want to read from, etc etc etc. Anyway apply KISS.

      Update: checkout also Net::Daemon it might simplify things for you.

      Regards,

      fmerges at irc.freenode.net
        thanks for the info fmerges. You have been a big help