PHP HI-REL SOCKET TCP/UDP/ICMP/Serial .高可靠性PHP通信&控制框架SOCKET-TCP/UDP/ICMP/硬件Serial-RS232/RS422/RS485 AND MORE!

Overview

OHSCE高可靠性的PHP通信框架.


Hey!I'm come back!
官方网站:WWW.OHSCE.ORG WWW.OHSCE.COM 最新版本V0.2.0.2 2017-05-10
开发者QQ群:374756165(新2016-09) 捐助: http://www.ohsce.com/index.php/company/

官方源码源地址(获取最新发布的官方版):
GITHUB:https://github.com/OpenIBC/Ohsce
GIT@OSC:https://git.oschina.net/SFXH/Ohsce #Open HI-REL Signal Communication Engine
PHP以太网(TCP/UDP/ICMP)、RS232、RS485通信,可广泛直接或桥接各种网络工程通信。
特别合适于对可靠性要求较高、上位机与末端协同工作的场景。如物联网设备通信、智能化系统、工业与自动化系统、可靠网络服务器、中控&边控&驱动。
可运行于Windows、Linux、OS X。对Windows提供了全项功能支持,与自动化生态亲和。
不过分追求高性能,充分平衡了可靠性与高性能。
天生支持分布式,可大规模部署。
在保证您的网络可靠性的前提下能跑出强悍的性能。
过程化函数风格的框架具备高效的特性。
特别亲切于工业自动化工程师、硬件工程师、物联网工程师、追求效率的PHP工程师的写法风格。
OHSCE开放源代码,在OHSCE授权协议框架下您可以免费使用!
-----------------------------------------------------------------------------------
PHP Ethernet (TCP/UDP/ICMP), RS232, RS485 communications, can be directly or directly bridged a variety of network engineering communications.
It is especially suitable for the scene with high reliability, the upper computer and the end work together. Things such as equipment communications, intelligent systems, industrial and automation systems, reliable network server, central control & edge control & drive.
Can run on Windows, Linux, OS X. Windows provides a full range of functional support, and automated ecological affinity. Not too much pursuit of high performance, fully balanced reliability and high performance.
Natural support for distributed, large-scale deployment.
In the premise of ensuring the reliability of your network can run out of strong performance.
The framework of the process function style has the characteristics of high efficiency.
Special kind in industrial automation engineers, hardware engineers, network engineers, the pursuit of efficiency PHP engineer writing style.
OHSCE open source code, under the OHSCE license agreement framework you can use free! #快速入门
http://www.ohsce.com/index.php/page/qstar.html
一、检查环境是否支持OHSCE
系统:Windows / Linux / OSX
建议:WINDOWSSERVER2008及以上 UbuntuServer14.04LTS及以上
PHP:5.4及以上
建议PHP5.4.9及以上
PHP扩展:
Socket,Shmop,Curl
二、修改配置文件
/config/oibc_sce_config.php
三、运行测试程序
3.1工作在以太网上
一个TCP服务端测试程序:


<?php
ini_set('memory_limit',"88M");//重置php可以使用的内存大小为64M
set_time_limit(0);
ob_implicit_flush(1);
i n c l u d e('loadohsce.php');
$trya='ohsce_server_Example ';
function example(&$socket,$buf,$len,$zv){ //收到数据时的回调函数
global $trya;
echo $buf;
Ohsce_socketwrite($socket,$trya.'hi '.$buf);
return true;
}
function exampleaccept(&$socket,$ip,$port,$zv){ //新客户端到访时的回调函数
global $trya;
Ohsce_socketwrite($socket,$trya.'Welcome'.$ip.':'.$port);
return true;
}
Ohsce_eng_socket_server($ohsceserver,'tcp',7626,'127.0.0.1','example','exampleaccept');//创建一个TCP服务端资源 绑定127.0.0.1:7626 并传入回调函数
Ohsce_eng_socket_server_runtcp($ohsceserver); //开始运行
对应的客户端测试程序:



ini_set('memory_limit',"88M");//重置php可以使用的内存大小为64M
set_time_limit(0);
ob_implicit_flush(1);
i n c l u d e('loadohsce.php');
Ohsce_eng_socket_client($ohsceclient,'tcp',7626,'127.0.0.1'); //创建一个TCP客户端资源并连接27.0.0.1:7626
echo Ohsce_socketread($ohsceclient['socket'],1024)[1]; //收取欢迎信息
Ohsce_socketsend($ohsceclient['socket'],'hello'); //发送数据
echo Ohsce_socketread($ohsceclient['socket'],1024)[1]; //收取回复数据
sleep(30);



3.2工作在工业自动化现场控制网络上

操作串口RS232/485测试程序:
ini_set('memory_limit',"88M");//重置php可以使用的内存大小为64M
set_time_limit(0);
ob_implicit_flush(1);
i n c l u d e('loadohsce.php');
Ohsce_eng_serial_creat($hscecom,"com7"); //OHSCE会默认为你创建一个 9600,n,8,1 写读的串口资源
Ohsce_eng_serial_open($hscecom); //一旦通过该函数成功开启了串口,此串口就被OHSCE进程占用了 此时串口资源变为可用状态
Ohsce_eng_serial_write($hscecom,"01030001000415c9",true);//向串口设备发送数据 以16进制发送
Ohsce_eng_serial_read($hscecom,$data,null,true); // 读取串口数据 返回数据长度为未知 以16进制返回
echo $data; //输出数据
sleep(30);



3.2.2串口服务器


3.3测试使用OHSCE的进程守护
我们先写一个无用的自杀进程
sleep(60);
exit;
编写OHSCE-PCENTER入口文件:
$ohsce_pcenter_pr_name='测试';
$ohsce_pcenter_pr_prun='\pexample.php';
$ohsce_pcenter_memmorykey=6901;//注意 不得与生成器冲突,否则请提前注册。
启动并守护这个进程



正式运行使用隐藏窗口模式。

3.4.1CLOUD_API
3.4.2 CLOUD_MODBUS_DRIVE
Ohsce_drive_cloud_modbus($comlink,"RTU","01",'01',"40001","0002");
MODBUS-RTU的一个相对完整的示例:http://www.ohsce.com/index.php/article/27.html

不断完善中,感谢支持。 #交流与捐助 开发者QQ群: 374756165(新2016-09)
关于我们&合作:
http://www.ohsce.com/index.php/company/
捐助:



ETH:0x42bCE0188534b27A156D6c80163d5248acb6a8EF
You might also like...
A easy way to install your basic yii projetc, we have encrypt database password in phpfile, my class with alot funtions to help you encrypt and decrypt and our swoole server install just run ./yii swoole/start and be happy!

Yii 2 Basic Project Template with swoole and Modules Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small proj

Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily.
Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily.

Leaf is a PHP framework that helps you create clean, simple but powerful web apps and APIs quickly and easily. Leaf introduces a cleaner and much simpler structure to the PHP language while maintaining it's flexibility. With a simple structure and a shallow learning curve, it's an excellent way to rapidly build powerful and high performant web apps and APIs.

Symprowire is a PHP MVC Framework based and built on Symfony, using the ProcessWire CMS as DBAL and Service Provider.

Symprowire - PHP MVC Framework for ProcessWire 3.x Symprowire is a PHP MVC Framework based and built on Symfony using ProcessWire 3.x as DBAL and Serv

FlyCubePHP is an MVC Web Framework developed in PHP and repeating the ideology and principles of building WEB applications, embedded in Ruby on Rails.

FlyCubePHP FlyCubePHP is an MVC Web Framework developed in PHP and repeating the ideology and principles of building WEB applications, embedded in Rub

Implementing programming best practices and patterns, and creating a custom PHP framework from scratch.

Implementing programming best practices and patterns, and creating a custom PHP framework from scratch.

Provides TemplateView and TwoStepView using PHP as the templating language, with support for partials, sections, and helpers.

Aura View This package provides an implementation of the TemplateView and TwoStepView patterns using PHP itself as the templating language. It support

An issue tracking tool based on hyperf+reactjs for small and medium-sized enterprises, open-source and free, similar to Jira.
An issue tracking tool based on hyperf+reactjs for small and medium-sized enterprises, open-source and free, similar to Jira.

介绍 本项目以 actionview 为蓝本,使用 Hyperf 框架进行重写。 本项目为 Hyperf 框架的 DEMO 项目 原 ActionView 介绍 English | 中文 一个类Jira的问题需求跟踪工具,前端基于reactjs+redux、后端基于php laravel-frame

AbuseIO is a toolkit to receive, process, correlate and notify about abuse reports received by network operators, typically hosting and access providers.

AbuseIO - Abusemanagement tools AbuseIO is a toolkit to receive, process, correlate and notify end users about abuse reports received by network opera

Dictionary of attack patterns and primitives for black-box application fault injection and resource discovery.

FuzzDB was created to increase the likelihood of finding application security vulnerabilities through dynamic application security testing. It's the f

TCP Worker Client for RoadRunner 2.0 application server

RoadRunner TCP Plugin RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supp

Spiral Scout 8 Nov 26, 2022
Async HTTP proxy connector, tunnel any TCP/IP-based protocol through an HTTP CONNECT proxy server, built on top of ReactPHP.

clue/reactphp-http-proxy Async HTTP proxy connector, tunnel any TCP/IP-based protocol through an HTTP CONNECT proxy server, built on top of ReactPHP.

Christian Lück 43 Dec 25, 2022
An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols. PHP>=5.3.

Workerman What is it Workerman is an asynchronous event-driven PHP framework with high performance to build fast and scalable network applications. Wo

walkor 10.2k Dec 31, 2022
PHP Web Socket server

Important ⛔️ This project is no longer maintained ⛔️ We urge you to look for a replacement. Description WebSocket Server and Client library for PHP. W

Chris Tanaskoski 346 Nov 8, 2022
A server side alternative implementation of socket.io in PHP based on workerman.

phpsocket.io A server side alternative implementation of socket.io in PHP based on Workerman. Notice Only support socket.io v1.3.0 or greater. This pr

walkor 2.1k Jan 6, 2023
FreeSWITCH Event Socket Layer library for PHP

FreeSWITCH Event Socket Layer library for PHP Quickstart FreeSWITCH's Event Socket Layer is a TCP control interface enabling the development of comple

rtckit 2 May 10, 2022
PHP Websocket Server that is compatible with socket.io

PHP SocketIO Server PHP Websocket Server that is compatible with socket.io So far the function use in this package is almost same with the naming in s

Cydrick Nonog 7 Dec 21, 2022
Tarantool connector for yii2 framework. Allow to use activerecord, schemas, widgets and more.

Tarantool connector for yii2 framework Tarantool connector for yii2 framework. Allow to use framework abstractions such as ActiveRecord, Schema, Table

Andrey 11 Nov 21, 2021
An enhanced FileInput widget for Bootstrap 4.x/3.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)

yii2-widget-fileinput The FileInput widget is a customized file input widget based on Krajee's Bootstrap FileInput JQuery Plugin. The widget enhances

Kartik Visweswaran 227 Nov 6, 2022
PHP Kafka client is used in PHP-FPM and Swoole. PHP Kafka client supports 50 APIs, which might be one that supports the most message types ever.

longlang/phpkafka Introduction English | 简体中文 PHP Kafka client is used in PHP-FPM and Swoole. The communication protocol is based on the JSON file in

Swoole Project 235 Dec 31, 2022