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

NAME

Device::Modbus::TCP - Distribution for Modbus TCP communications

SYNOPSIS

#! /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;

DESCRIPTION

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.

GITHUB REPOSITORY

You can find the repository of this distribution in GitHub.

AUTHOR

Julio Fraire, <julio.fraire@gmail.com>

COPYRIGHT AND LICENSE

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.