Serialization | Iot framework ServerSuperIO tutorial-8. single-instance communication mode development and precautions, cocoa framework Singleton

Source: Internet
Author: User

Serialization | Iot framework ServerSuperIO tutorial-8. single-instance communication mode development and precautions, cocoa framework Singleton

1. C # Introduction to cross-platform Iot communication framework ServerSuperIO (SSIO)

Serialization | Iot framework ServerSuperIO tutorial 1.4 communication modes and mechanisms.

Serialization | Iot framework ServerSuperIO tutorial 2. service instance configuration parameters

Serialization | Iot framework ServerSuperIO tutorial-3. Device Driver Introduction

Serialization | Iot framework ServerSuperIO tutorial-4. For example, you can develop a device driver that supports both serial and network communication.

Serialization | Iot framework ServerSuperIO tutorial-5. Polling communication mode development and precautions.

Serialization | Iot framework ServerSuperIO tutorial-6. concurrent communication mode development and precautions

Serialization | Iot framework ServerSuperIO tutorial-7. Self-control communication mode development and precautions

 

 

Contents

8. Singleton communication mode development and precautions... 2

8.1 overview... 2

8.2 communication mechanism description... 2

8.3 precautions for device driver development... 2

8.4 host program service instance configuration considerations... 3

8.5 running effect in singleton mode... 4

8. single-instance communication mode development and precautions 8.1 Overview

The Singleton communication mode is only applicable to network communication, and only one "device driver" can be added. Here, "device driver" is a logical concept that represents all devices or sensors, that is to say, all received data is distributed to the device driver ".

8.2 communication mechanism description

This control mode can be used only for network communication. A service instance can have only one device driver, which is equivalent to a device driver that corresponds to more than N hardware device terminals. It is more suitable for communication data protocols with fixed standards to process different data with command keywords. Suitable for highly concurrent hardware terminal devices to actively upload data. The server processes and returns the corresponding data based on the data information.

The communication structure is as follows:

 

 

8.3 precautions for device driver development

The development of device drivers in singleton mode is simpler. if the business is not complex, only initialization parameters, real-time data, protocols, and data processing logic are involved,More advanced applications will involve the IReceiveFilter interface, IService interface, and IGraphicsShow interface, which will be introduced one by one in subsequent articles.

8.4 host program service instance configuration considerations

Sta

Static void Main (string [] args) {// 55 AA 00 61 43 7A 00 00 43 B4 15 0D DeviceSingletonDriver dev1 = new DeviceSingletonDriver (); dev1.DeviceParameter. deviceName = "network device"; dev1.DeviceParameter. deviceAddr = 0; dev1.DeviceParameter. deviceID = "0"; dev1.DeviceDynamic. deviceID = "0"; dev1.DeviceParameter. deviceCode = "0"; dev1.DeviceParameter. NET. remoteIP = "127.0.0.1"; dev1.DeviceParameter. NET. remotePort = 9600; dev1.CommunicateType = CommunicateType. NET; dev1.Initialize ("0"); IServer server = new ServerManager (). createServer (new ServerConfig () {ServerName = "Singleton service", NetReceiveBufferSize = 1024, ControlMode = ControlMode. singleton, MaxConnects = 4000}); server. addDeviceCompleted + = server_AddDeviceCompleted; server. deleteDeviceCompleted + = server_DeleteDeviceCompleted; server. socketConnected + = server_SocketConnected; server. socketClosed + = server_SocketClosed; server. start (); server. addDevice (dev1); while ("exit" = Console. readLine () {server. stop ();}}

ControlMode = ControlMode. Set Singleton to the unit mode.

8.5 running effect in singleton Mode

I ran 100 million concurrent connections on the local machine. The jmeter and jmeter used about 90% GB of memory and more than CPUs. I don't know why this is so resource-consuming, the notebook barely works.

Now we simulate 15 clients and send data once every 100 milliseconds. The effect is as follows:

1. [serialization] C # communication (Serial Port and network) Framework Design and Implementation

2. [Open Source] C # cross-platform Iot communication framework ServerSuperIO (SSIO) Introduction

2. Overall system construction solution using SuperIO and open-source cross-platform Iot framework ServerSuperIO

3. C # technical route of industrial IoT and integrated system solutions (data sources, data collection, data upload and receiving, ActiveMQ, Mongodb, WebApi, and mobile App)

5. ServerSuperIO Open Source Address: https://github.com/wxzz/ServerSuperIO

Internet of Things & integrated technology (. NET) QQ Group:54256083

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.