Thanks to visit codestin.com
Credit goes to github.com

Skip to content
forked from Larsiiii/s7client

This crate provides a library for reading and writing data to and from PLC devices of the Siemens S7 family

License

tmoinel/s7client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S7Client

This crate provides a library for reading and writing data to and from PLC devices of the Siemens S7 family.

Until now the crate is not tested on actual hardware but only on an implementation of the Snap7 server that mocks an S7 PLC.

Usage

This crate is on github.com and can be used by adding s7client to your dependencies in your project's Cargo.toml.

[dependencies]
s7client = { git = "https://github.com/Larsiiii/s7client" }

Examples

A connection with a PLC can either be opened via a standalone connection (S7Client) or with a connection pool (S7Pool).

Connection via standalone connection

use std::net::Ipv4Addr;
use s7client::{S7Client, S7Types};

// create single s7 client
let mut client = S7Client::new(Ipv4Addr::new(127, 0, 0, 1), S7Types::S71200)
    .await
    .expect("Could not create S7 Client");

// read some data
let data = client.db_read(100, 0, 4).await.expect("Could not read from S7 PLC");

Connection via a pooled connection

use std::net::Ipv4Addr;
use s7client::{S7Pool, S7Types};

// create connection pool
let mut client = S7Pool::new(Ipv4Addr::new(127, 0, 0, 1), S7Types::S71200);

// read some data
let data = client.db_read(100, 0, 4).await.expect("Could not read from S7 PLC");

About

This crate provides a library for reading and writing data to and from PLC devices of the Siemens S7 family

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%