Jump to content

Component: Network Communications (Comms: Networking)

From Flowcode Help
Revision as of 13:12, 7 February 2023 by Wiki bot (talk | contribs)
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

AcceptClose

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


AcceptOpen

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


Connect

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


Initialise

Initialise
Initialises the network communications component. 
- VOID Return


Listen

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


Receive

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

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


SocketClose

SocketClose
Closes the current socket connection 
- VOID Return


SocketOpen

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


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.