Device::Modbus::TCP - Distribution for Modbus TCP communications
#! /usr/bin/perl use Device::Modbus::TCP::Client; use Data::Dumper; use strict; use warnings; use v5.10; my $client = Device::Modbus::TCP::Client->new( host => '192.168.1.34', ); my $req = $client->read_holding_registers( unit => 3, address => 2, quantity => 1 ); say Dumper $req; $client->send_request($req) || die "Send error: $!"; my $response = $client->receive_response; say Dumper $response; $client->disconnect;
Device::Modbus::TCP is a distribution which implements the Modbus TCP protocol on top of Device::Modbus; it adds the capability of communicating via TCP sockets. Please see Device::Modbus to learn about its functionality, and Device::Modbus::TCP::Client or Device::Modbus::TCP::Server to see the particularities of the Modbus TCP implementation.
You can find the repository of this distribution in GitHub.
Julio Fraire, <julio.fraire@gmail.com>
Copyright (C) 2015 by Julio Fraire This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
To install Device::Modbus::TCP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::Modbus::TCP
CPAN shell
perl -MCPAN -e shell install Device::Modbus::TCP
For more information on module installation, please visit the detailed CPAN module installation guide.