20.1 Overview
Serversuperio originally in network communication mode, only one network controller, in the auto-control mode, concurrency mode and singleton mode is the asynchronous processing of the returned data, and there will be no performance issues. However, in polling mode, one network controller should operate the device-driven send and receive sequentially, so that the polling cycle is too long and the frequency of reading data is not reached.
In order to solve the above problems, the device-driven parameters are now added to the Network controller grouping function, the network controller will be based on the device parameters set the group name control device driver. For example, in polling mode, there are 1000 device drivers, each 10 device drivers can set the same grouping name, the 10 device drivers are controlled by the same network controller, if the data is read every 1s interval, then each device driver polling cycle is 10s clock, other network controller similar.
20.2 Network Controller
The device driver can be assigned to different network control according to the controllergroup of setting device drive network parameter, and it is suitable for polling, auto-control, concurrency and single-case control mode.
20.3 Serial Controller
By the way, the serial controller, by setting the device-driven serial number to decide to be assigned to a different serial controller, the controller can only be used for polling control mode.
20.4 Device-driven network controller grouping sample code
static void Main (string[] args) {string DeviceID = "2"; Devicedriver dev3 = new Devicedriver (); Dev3. Deviceparameter.devicename = "Device 2"; Dev3. deviceparameter.deviceaddr = 0; Dev3. Deviceparameter.deviceid = DeviceID; Dev3. Deviceparameter.devicecode = DeviceID; Dev3. Devicedynamic.deviceid = DeviceID; Dev3.DeviceParameter.NET.RemoteIP = "127.0.0.1"; Dev3.DeviceParameter.NET.RemotePort = 9600; Dev3.DeviceParameter.NET.ControllerGroup = "G2"; Dev3.communicatetype = communicatetype.net; Dev3.DeviceParameter.NET.WorkMode = Workmode.tcpserver; Dev3. Initialize (DeviceID); DeviceID = "3"; Devicedriver dev4 = new Devicedriver (); Dev4. Deviceparameter.devicename = "Device 3"; Dev4. deviceparameter.deviceaddr = 0; Dev4. Deviceparameter.deviceid = DeviceID; Dev4. Deviceparameter.devicecode = DeviceID; Dev4. Devicedynamic.deviceid = DeviceID; Dev4.DeviceParameter.NET.RemoteIP = "127.0.0.1"; Dev4.DeviceParameter.NET.RemotePort = 9600; Dev4.DeviceParameter.NET.ControllerGroup = "G3"; Dev4.communicatetype = communicatetype.net; Dev4. Initialize (DeviceID); IServer Server = new Servermanager (). Createserver (New Serverconfig () {ServerName = "Service 1", Comreadtimeout = 1000, Comwritetimeout = Netreceivetimeout = +, netsendtimeout = 1000, Controlmode = controlmode.loop, Socketmode = socketmode.tcp, Startreceivedatafliter = False, Clearsocketsession = True, Startcheckpackagelength = False, Checksame Socketsession = False,}); Server. adddevicecompleted + = server_adddevicecompleted; Server. DeleteDevicecompleted + = server_deletedevicecompleted; Server. socketconnected+=server_socketconnected; Server. socketclosed+=server_socketclosed; Server. Start (); Server. AddDevice (DEV3); Server. AddDevice (DEV4); while ("Exit" ==console.readline ()) {server. Stop (); } }