Difference between revisions of "Component: Network Communications Dummy (Comms: Networking)"
| Line 17: | Line 17: | ||
==Component Source Code==  | ==Component Source Code==  | ||
| − | Please click here   | + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_NetworkCommsDummy.fcfx FC_Comp_Source_NetworkCommsDummy.fcfx]  | 
==Detailed description==  | ==Detailed description==  | ||
| + | |||
| + | |||
| Line 40: | Line 42: | ||
==Examples==  | ==Examples==  | ||
| + | |||
| + | |||
| Line 127: | Line 131: | ||
==Macro reference==  | ==Macro reference==  | ||
| + | |||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connect'''  | ||
| + | |-  | ||
| + | | colspan="2" | Connects to an IP address as a client on the specified port. Some TCP/IP modules (RPI and ESP8266) will accept a URL instead of an IP address. Returns: 0=Fail, 1=OK   | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING  | ||
| + | | width="90%" | Address  | ||
| + | |-  | ||
| + | | colspan="2" | IP address as a string e.g. "192.168.1.1" or URL on some TCP/IP modules   | ||
| + | |-  | ||
| + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT  | ||
| + | | width="90%" | Port  | ||
| + | |-  | ||
| + | | colspan="2" |    | ||
| + | |-  | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL  | ||
| + | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| + | |||
| + | |||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Receive'''  | ||
| + | |-  | ||
| + | | colspan="2" | Attempts to receive up to a specified number of bytes from the active connection. Returns the number of bytes received.   | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING  | ||
| + | | width="90%" | Data  | ||
| + | |-  | ||
| + | | colspan="2" |    | ||
| + | |-  | ||
| + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT  | ||
| + | | width="90%" | Count  | ||
| + | |-  | ||
| + | | colspan="2" | Maximum number of bytes to read   | ||
| + | |-  | ||
| + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT  | ||
| + | | width="90%" | Timeout  | ||
| + | |-  | ||
| + | | colspan="2" | Maximum wait time in mS (approx)   | ||
| + | |-  | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT  | ||
| + | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| + | |||
| + | |||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Send'''  | ||
| + | |-  | ||
| + | | colspan="2" | Sends the specified number of bytes via the active connection. Returns the number of bytes sent, 0=Fail.   | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING  | ||
| + | | width="90%" | Data  | ||
| + | |-  | ||
| + | | colspan="2" | Array containing the data to send   | ||
| + | |-  | ||
| + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT  | ||
| + | | width="90%" | Count  | ||
| + | |-  | ||
| + | | colspan="2" | Number of bytes to send from the data array   | ||
| + | |-  | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT  | ||
| + | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| + | |||
| + | |||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Listen'''  | ||
| + | |-  | ||
| + | | colspan="2" | Bind the socket to a port on the local host and set to listen mode. Returns: 0=Fail, 1=OK   | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT  | ||
| + | | width="90%" | Port  | ||
| + | |-  | ||
| + | | colspan="2" |    | ||
| + | |-  | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL  | ||
| + | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| + | |||
| + | |||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SocketOpen'''  | ||
| + | |-  | ||
| + | | colspan="2" | Attempts to create a socket on the local device. This must be succesful to allow TCP/IP communications with a remote destination. Returns: 0=Fail / 1=OK   | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL  | ||
| + | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| + | |||
| + | |||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SocketClose'''  | ||
| + | |-  | ||
| + | | colspan="2" | Closes the current socket connection   | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID  | ||
| + | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| + | |||
| + | |||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AcceptOpen'''  | ||
| + | |-  | ||
| + | | colspan="2" |    | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE  | ||
| + | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| + | |||
| + | |||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AcceptClose'''  | ||
| + | |-  | ||
| + | | colspan="2" |    | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID  | ||
| + | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| + | |||
| + | |||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''  | ||
| + | |-  | ||
| + | | colspan="2" |    | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID  | ||
| + | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ==Property reference==  | ||
| + | |||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''   | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" | [[File:Fc9-type-17-icon.png]]  | ||
| + | | width="90%" | TCP/IP Component  | ||
| + | |-  | ||
| + | | colspan="2" | Property to point to the TCP/IP or WIFI component you want to use. If unconnected then default to simulated TCP/IP network communications using the PC network adapter.   | ||
| + | |-  | ||
| + | | width="10%" align="center" | [[File:Fc9-type-10-icon.png]]  | ||
| + | | width="90%" | Status  | ||
| + | |-  | ||
| + | | colspan="2" |    | ||
| + | |}==Macro reference==  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
Revision as of 15:16, 20 January 2023
| Author | Matrix TSL | 
| Version | 1.1 | 
| Category | Comms: Networking | 
Contents
Network Communications Dummy component
A component designed to simplify the process of TCP/IP communications. Compatible with most of the Flowcode supported TCP/IP and WIFI components. A useful building block for creating components such as IoT and Modbus TCP.
Component Source Code
Please click here to view the component source code (Beta): FC_Comp_Source_NetworkCommsDummy.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Here are some examples showing the Network Communications component in action.
By itself the component provides a generic TCP/IP layer to drive the simulation runtime.
Here is a simple example showing the component used by itself to request data from a remote server on the internet.
Library Components
Components such as Webserver (GENERIC), MQTT and Modbus TCP can connect to and control the network comms layer.
Here is a simple example showing the component used with the Webserver (GENERIC) component.
Example Network Comms Web Server
Embedded Components
The Network Communications component can also be connected to embedded TCP/IP and WIFI style modules allowing for the abstraction to work with specific networking hardware modules.
Here is the current status of the Network Communications component with the various embedded modules. 
| Embedded Component | Other Variants of Component | Support Status | 
|---|---|---|
| TCP/IP (Raspberry Pi) | N/A | Fully Supported | 
| WLAN (ESP8266) | WLAN (ESP-12S), WIFI (BL0136), WIFI (ESP8266) | Fully Supported | 
| TCP/IP (W5500) | N/A | Fully Supported | 
| ENC28J60 | N/A | On Hold | 
| TCP/IP (NM7010A) | TCP/IP (EB023v1) | On Hold | 
| TCP/IP (W5100) | TCP/IP (EB023v2), TCP/IP (WIZ810MJ) | On Hold | 
| WLAN (WIZ610WI) | WIFI (EB069) | On Hold | 
We are working through and adding support as and when we get chance so if you have a module that isn't listed or would like to try and prioritise a specific module then you can let us know via the user forums.
Macro reference
| Listen | |
| Bind the socket to a port on the local host and set to listen mode. Returns: 0=Fail, 1=OK | |
| Port | |
| Return | |
| SocketOpen | |
| Attempts to create a socket on the local device. This must be succesful to allow TCP/IP communications with a remote destination. Returns: 0=Fail / 1=OK | |
| Return | |
| SocketClose | |
| Closes the current socket connection | |
| Return | |
| AcceptOpen | |
| Return | |
| AcceptClose | |
| Return | |
| Initialise | |
| Return | |
Property reference
==Macro reference==
| Listen | |
| Bind the socket to a port on the local host and set to listen mode. Returns: 0=Fail, 1=OK | |
| Port | |
| Return | |
| SocketOpen | |
| Attempts to create a socket on the local device. This must be succesful to allow TCP/IP communications with a remote destination. Returns: 0=Fail / 1=OK | |
| Return | |
| SocketClose | |
| Closes the current socket connection | |
| Return | |
| AcceptOpen | |
| Return | |
| AcceptClose | |
| Return | |
| Initialise | |
| Return | |

