Jump to content

Component: Network Communications (Comms: Networking): Difference between revisions

From Flowcode Help
No edit summary
No edit summary
Line 22: Line 22:


==Detailed description==
==Detailed description==




Line 43: Line 45:




''<span style="color:red;">No additional examples</span>''


==Macro reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
''<span style="color:red;">No additional examples</span>''
|-
| 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&nbsp;
|-
|-
| 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&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" | Port number to connect to.&nbsp;
|-
| 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.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
| colspan="2" | Data Array to store the data into.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Maximum number of bytes to read&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Timeout
|-
| colspan="2" | Maximum time to wait in mS (approx)&nbsp;
|-
| 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''
|}


 
==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;" | '''Send'''
|-
| colspan="2" | Sends the specified number of bytes via the active connection. Returns the number of bytes sent, 0=Fail.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
| colspan="2" | Array containing the data to send&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to send from the data array&nbsp;
|-
| 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. First Open a Socket on the local host Returns: 0=Fail, 1=OK&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" | Port number to listen on.&nbsp;
|-
| 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&nbsp;
|-
|-
| 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&nbsp;
|-
|-
| 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" | Required for systems where there can be multiple incoming threads Returns 1 if there is incoming comms requiring a new thread, else returns 0&nbsp;
|-
|-
| 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" | Goes with the AcceptOpen function to close the new thread handle.&nbsp;
|-
|-
| 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" | Initialises the network communications component.&nbsp;
|-
|-
| 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-16-icon.png]]
| width="90%" | LinkTo
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | TCP IP Channel
|-
| colspan="2" | Allows for several parallel TCP/IP communications channels to be active at once by selecting unique TCP IP channels for each Network Comms component. Default 0.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | Status
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Simulation Control
|-
| colspan="2" | Allows the user to decide what happens when simulating. Simulation DLL forces all simulated TCP/IP comms to go directly via the simulation DLL bypassing any additional components. Component simulation forces the attached component to provide the simulation and maybe other aspects such as SPI/I2C communications.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Network Interface
|-
| colspan="2" | Some computers may have several network interfaces such as ethernet ports and wifi access. Select the correct network interface for the network you wish to connect to. Use the IP address to confirm you are connected to the right network.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | IP Address
|-
| colspan="2" | IP Address of the selected network interface.&nbsp;
|}==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&nbsp;
|-
|-
| 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&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" | Port number to connect to.&nbsp;
|-
| 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.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
| colspan="2" | Data Array to store the data into.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Maximum number of bytes to read&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Timeout
|-
| colspan="2" | Maximum time to wait in mS (approx)&nbsp;
|-
| 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.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
| colspan="2" | Array containing the data to send&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to send from the data array&nbsp;
|-
| 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. First Open a Socket on the local host Returns: 0=Fail, 1=OK&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" | Port number to listen on.&nbsp;
|-
| 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&nbsp;
|-
|-
| 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&nbsp;
|-
|-
| 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" | Required for systems where there can be multiple incoming threads Returns 1 if there is incoming comms requiring a new thread, else returns 0&nbsp;
|-
|-
| 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" | Goes with the AcceptOpen function to close the new thread handle.&nbsp;
|-
|-
| 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" | Initialises the network communications component.&nbsp;
|-
|-
| 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-16-icon.png]]
| width="90%" | LinkTo
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | TCP IP Channel
|-
| colspan="2" | Allows for several parallel TCP/IP communications channels to be active at once by selecting unique TCP IP channels for each Network Comms component. Default 0.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | Status
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Simulation Control
|-
| colspan="2" | Allows the user to decide what happens when simulating. Simulation DLL forces all simulated TCP/IP comms to go directly via the simulation DLL bypassing any additional components. Component simulation forces the attached component to provide the simulation and maybe other aspects such as SPI/I2C communications.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Network Interface
|-
| colspan="2" | Some computers may have several network interfaces such as ethernet ports and wifi access. Select the correct network interface for the network you wish to connect to. Use the IP address to confirm you are connected to the right network.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | IP Address
|-
| colspan="2" | IP Address of the selected network interface.&nbsp;
|}==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&nbsp;
|-
|-
| 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&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" | Port number to connect to.&nbsp;
|-
| 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.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
| colspan="2" | Data Array to store the data into.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Maximum number of bytes to read&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Timeout
|-
| colspan="2" | Maximum time to wait in mS (approx)&nbsp;
|-
| 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.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
| colspan="2" | Array containing the data to send&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to send from the data array&nbsp;
|-
| 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. First Open a Socket on the local host Returns: 0=Fail, 1=OK&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" | Port number to listen on.&nbsp;
|-
| 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&nbsp;
|-
|-
| 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&nbsp;
|-
|-
| 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" | Required for systems where there can be multiple incoming threads Returns 1 if there is incoming comms requiring a new thread, else returns 0&nbsp;
|-
|-
| 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" | Goes with the AcceptOpen function to close the new thread handle.&nbsp;
|-
|-
| 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" | Initialises the network communications component.&nbsp;
|-
|-
| 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-16-icon.png]]
| width="90%" | LinkTo
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | TCP IP Channel
|-
| colspan="2" | Allows for several parallel TCP/IP communications channels to be active at once by selecting unique TCP IP channels for each Network Comms component. Default 0.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | Status
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Simulation Control
|-
| colspan="2" | Allows the user to decide what happens when simulating. Simulation DLL forces all simulated TCP/IP comms to go directly via the simulation DLL bypassing any additional components. Component simulation forces the attached component to provide the simulation and maybe other aspects such as SPI/I2C communications.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Network Interface
|-
| colspan="2" | Some computers may have several network interfaces such as ethernet ports and wifi access. Select the correct network interface for the network you wish to connect to. Use the IP address to confirm you are connected to the right network.&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | IP Address
|-
| colspan="2" | IP Address of the selected network interface.&nbsp;
|}==Macro reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"

Revision as of 16:49, 30 January 2023

Author Matrix TSL
Version 1.5
Category Comms: Networking


Network Communications 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 download the component source project: FC_Comp_Source_NetworkComms.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_NetworkComms.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples


Macro reference

Connect
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 
- STRING Address
IP address as a string e.g. "192.168.1.1" or URL on some TCP/IP modules 
- UINT Port
Port number to connect to. 
- BOOL Return


Receive
Attempts to receive up to a specified number of bytes from the active connection. Returns the number of bytes received. 
- STRING Data
Data Array to store the data into. 
- UINT Count
Maximum number of bytes to read 
- UINT Timeout
Maximum time to wait in mS (approx) 
- UINT Return


Send
Sends the specified number of bytes via the active connection. Returns the number of bytes sent, 0=Fail. 
- STRING Data
Array containing the data to send 
- UINT Count
Number of bytes to send from the data array 
- UINT Return


Listen
Bind the socket to a port on the local host and set to listen mode. First Open a Socket on the local host Returns: 0=Fail, 1=OK 
- UINT Port
Port number to listen on. 
- BOOL 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 
- BOOL Return


SocketClose
Closes the current socket connection 
- VOID Return


AcceptOpen
Required for systems where there can be multiple incoming threads Returns 1 if there is incoming comms requiring a new thread, else returns 0 
- BYTE Return


AcceptClose
Goes with the AcceptOpen function to close the new thread handle. 
- VOID Return


Initialise
Initialises the network communications component. 
- VOID Return



Property reference

Properties
LinkTo
 
TCP IP Channel
Allows for several parallel TCP/IP communications channels to be active at once by selecting unique TCP IP channels for each Network Comms component. Default 0. 
Status
 
Simulation
Simulation Control
Allows the user to decide what happens when simulating. Simulation DLL forces all simulated TCP/IP comms to go directly via the simulation DLL bypassing any additional components. Component simulation forces the attached component to provide the simulation and maybe other aspects such as SPI/I2C communications. 
Network Interface
Some computers may have several network interfaces such as ethernet ports and wifi access. Select the correct network interface for the network you wish to connect to. Use the IP address to confirm you are connected to the right network. 
IP Address
IP Address of the selected network interface.