Difference between revisions of "Plugin Tcp"
m (1 revision) |
m (1 revision) |
(No difference)
|
Latest revision as of 11:25, 13 January 2021
Go to the main Plugins page.
Go to the complete Plugin List.
Version 1 (old) documentation.
Contents
Plugin Description
Send and Receive packets on TCP sockets
Actions for the TCP plugin
Single
These commands will:
-open a new connection
-send a string
-close the connection immediately
Write
TCP.Single.Write
Will send the string <Message> without adding a carriage-return to the IP and port specified in plugin settings.
To include bytes in the <message>, you can encode bytes as follows
0: \x00
1: \x01
255: \xFF
Optional Parameters can override target IP and Port
- Parameters: 1-3
- Message : TCP message to send. Encode bytes as \x00\x01...\xFF [string]
- IP : blank = use default [string]
- Port : blank = use default [integer]
WriteLn
TCP.Single.WriteLn
Will send the string <Message> followed by a carriage-return (\x0D) to the IP and port specified in plugin settings.
To include bytes in the <message>, you can encode bytes as follows
0: \x00
1: \x01
255: \xFF
Optional Parameters can override target IP and Port
- Parameters: 1-3
- Message : TCP message to send [string]
- IP : blank = use default [string]
- Port : blank = use default [integer]
Client
Create a named client, and connect to a server.
Write to the server.
Receive messages back from the server as events.
Connect
- Parameters: 3-5
- Name : Name of client to create [string]
- Ip : Address of server to connect to [string]
- Port : Port of server to connect to [integer]
- Terminator : Server terminates messages with this byte [string]
- EventName : Generate events with this name when message received from server [string]
Disconnect
TCP.Client.Disconnect
Client will disconnect and be destroyed.
You can reconnect using the name afterwards.
If you only want to send a single command and then disconnecter consider using TCP.Single.Write instead
- Parameters: 1
- Name : Name of client to disconnect from [string]
Write
Tcp.Client.Write
ClientName must be the name of a client that was previously created using Tcp.Client.Connect
To include bytes in the <message>, you can encode bytes as follows
0: \x00
1: \x01
255: \xFF
- Parameters: 2-4
- ClientName : Name of client to use [string]
- Message : Message to send [string]
- Delay : Milliseconds to wait after sending the message (default is 10) [integer]
- Notes : [string]
WriteLn
Tcp.Client.WriteLn
ClientName must be the name of a client that was previously created using Tcp.Client.Connect
To include bytes in the <message>, you can encode bytes as follows
0: \x00
1: \x01
255: \xFF
Message will automatically have a carriage return added to it ( \x0D )
- Parameters: 2-4
- ClientName : [string]
- Message : [string]
- Delay : Milliseconds to wait after sending the message (default is 10) [integer]
- Notes : [string]
Server
Create TCP servers that can listen for connections, and receive messages.
Messages can trigger VC actions or be used to create events.
Start
TCP.Server.Start
If <genEvent> parameter is ommited or blank, all incoming client messages will be treated as commands intended for VC. Example: incoming message "VC.On" will turn VC green.
If <genEvent> is specified, then all incoming requests will generate an event and the message from the client will be passed as a payload(s)
If <genEvent> is used, and the message contains '&&' multiple payoads will be created.
- Parameters: 1-2
- Port : Tcp port to listen on [integer]
- GenEvent : Generate an event instead of sending command to VC [string]
Stop
TCP.Server.Stop
Stops the server running on <Port>
Server must first have been created using Tcp.StartServer
- Parameters: 1
- Port : Port of server to close [integer]
WebServer
Create web servers that can receive message via http protocol.
Messages can trigger VC actions or be used to create events.
Start
TCP.WebServer.Start
If <genEvent> parameter is omitted or blank, all incoming client messages will be treated as commands intended for VC. Example: incoming message "VC.On" will turn VC green.
If <genEvent> is specified, then all incoming requests will generate an event and the message from the client will be passed as a payload(s)
If <genEvent> is used, and the message contains '&&' multiple payloads will be created.
- Parameters: 1-2
- Port : Tcp port to listen on [integer]
- GenEvent : Generate an event instead of sending command to VC [string]
Stop
TCP.WebServer.Stop
Stops the web server running on <Port>
Web server must first have been created using Tcp.WebServer.Start
- Parameters: 1
- Port : Port of server to close [integer]