Jump to content

Component: TCP Template (Comms: Networking): Difference between revisions

From Flowcode Help
XML import
No edit summary
Line 1: Line 1:
 
{| style="width:50%"
 
{| width="50%"
|-
|-
| width="20%" style="color: gray;" | Author
| width="20%" style="color:gray;" | Author
| Matrix Ltd.
| Matrix Ltd.
|-
|-
| width="20%" style="color: gray;" | Version
| width="20%" style="color:gray;" | Version
| 2.0 (Release)
| 2.2
|-
|-
| width="20%" style="color: gray;" | Category
| width="20%" style="color:gray;" | Category
| Comms: Networking
| Comms: Networking
|}
|}




==TCP Template component==
Base TCP/IP component with simulation only interface to allow TCP/IP style network communications in simulation. Suitable for inheriting
==Detailed description==


==[[File:Component Icon 54369d81_80ed_4d59_97bf_91f4b2cdf24c.png|Image]] TCP Template component==
''No detailed description exists yet for this component''
Base TCP/IP component with simulation only interface to allow TCP/IP style network communications in simulation.
Suitable for inheriting


==Examples==
==Examples==
Additional examples can be found in the “Apps and Bundles” section of this Wiki:  
Additional examples can be found in the “Apps and Bundles” section of this Wiki:  


Line 28: Line 30:
==Downloadable macro reference==
==Downloadable macro reference==


''This component does not contain any downloadable macros''
{| 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;" | '''TxSendMyIP'''
|-
| colspan="2" | This macro fills the specified channel's transmit buffer with 4 bytes of data representing this Internet E-Block's IP address as specified in the component's property page. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3 
|-
| 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''
|}


==Simulation macro reference==


===<span style="font-weight: normal;"><u><tt>TxSendMyIP</tt></u></span>===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
This macro fills the specified channel's transmit buffer with 4 bytes of data representing this Internet E-Block's IP address as specified in the component's property page.
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxMatchMyIP'''
|-
| colspan="2" | This macro returns a non-zero value when the next 4 bytes of data in the specified channel's reception buffer are the same as the Internet E-block's IP address.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}


'''Parameters'''


:[[Variable Types|BYTE]] ''Channel''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Specifies the communications channel 0-3
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxMatch_4_Bytes'''
|-
| colspan="2" | This macro returns a non-zero value when the next 4 bytes of data in the specified channel's reception buffer are the same as those passed as parameters.  There are similar functions that check for 2 bytes and 6 bytes.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte1
|-
| colspan="2" | Specifies the value of the first byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte2
|-
| colspan="2" | Specifies the value of the second byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte3
|-
| colspan="2" | Specifies the value of the third byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte4
|-
| colspan="2" | Specifies the value of the fourth byte&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''
|}




'''Return value'''
{| 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;" | '''SetPropertyVal'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Property
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Value
|-
| colspan="2" | &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''
|}


:''This call does not return a value''


{| 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;" | '''SetMyIP'''
|-
| colspan="2" | This macro sets up the Internet E-Block's own IP address.  In most circumstances, this macro will not be required as the IP address setting in the component property page will remain constant throughout your application.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP0
|-
| colspan="2" | First Byte of IP address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP1
|-
| colspan="2" | Second Byte of IP address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP2
|-
| colspan="2" | Third Byte of IP address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP3
|-
| colspan="2" | Fourth Byte of IP address&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''
|}


===<span style="font-weight: normal;"><u><tt>RxMatchMyIP</tt></u></span>===
This macro returns a non-zero value when the next 4 bytes of data in the specified channel's reception buffer are the same as the Internet E-block's IP address.


'''Parameters'''
{| 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;" | '''TxSendString'''
|-
| colspan="2" | This macro fills the specified channel's transmit buffer with data.  It can fill the buffer with a single byte of data, or with a string of information.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
| colspan="2" | Data byte to append to Tx buffer.&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''
|}


:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3


{| 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;" | '''SecureWrite'''
|-
| colspan="2" | Attempts to write max number of bytes to the secure socket from the buffer. Returns actual number of bytes written.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | buffer
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:]] -
| width="90%" | max
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


'''Return value'''


:[[Variable Types|BYTE]]
{| 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" | Attempt to connect to the given address and port. First open a socket on the local device using the Socket function and check that it is successful. &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Address
|-
| colspan="2" | Remote destination address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" | Remote destination port&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''
|}




===<span style="font-weight: normal;"><u><tt>RxMatch_4_Bytes</tt></u></span>===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
This macro returns a non-zero value when the next 4 bytes of data in the specified channel's reception buffer are the same as those passed as parameters. There are similar functions that check for 2 bytes and 6 bytes.
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ForcePropEvent'''
|-
| colspan="2" | Allows the property event to be fired, doing things like fetching the correct IP for the network interface.&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''
|}


'''Parameters'''


:[[Variable Types|BYTE]] ''Channel''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Specifies the communications channel 0-3
|-
| 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" | Receive data into the data buffer. Returns the number of bytes received&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
| colspan="2" | Data byte buffer to receive the data&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" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:[[Variable Types|BYTE]] ''Byte1''
::Specifies the value of the first byte


:[[Variable Types|BYTE]] ''Byte2''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Specifies the value of the second byte
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendTo'''
|-
| colspan="2" | Send data to a destination host. Returns the number of bytes sent.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
| colspan="2" | Data byte buffer to send&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to send&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Address
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" | &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''
|}


:[[Variable Types|BYTE]] ''Byte3''
::Specifies the value of the third byte


:[[Variable Types|BYTE]] ''Byte4''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Specifies the value of the fourth byte
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SecureConnect'''
|-
| colspan="2" | Connect securely to host and port. e.g. “www.bbc.co.uk:443” Returns 1 if successful, 0 if not&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | host
|-
| colspan="2" | Host:Port as string&nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




'''Return value'''
{| 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;" | '''RxReadHeader'''
|-
| colspan="2" | Once data in a particular channel has been received, the header will be filled with information about the received data.  This macro will return the information in the header.  The idx parameter specifies which byte of information in the header to read &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Idx
|-
| colspan="2" | Specifies the byte index to return&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''
|}


:[[Variable Types|BYTE]]


{| 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;" | '''RxSkipBytes'''
|-
| colspan="2" | Often when receiving data packets, it may be necessary to ignore large sections of the data.  This can be achieved by reading each byte individually (and ignoring the returned data), but a better way is to use this Rx_skipbytes macro.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Count
|-
| colspan="2" | Specifies how many bytes to skip&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''
|}


===<span style="font-weight: normal;"><u><tt>SetPropertyVal</tt></u></span>===
''<span style="color:red;">No additional information</span>''


{| 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;" | '''CreateIPSocket'''
|-
| colspan="2" | Note that sockets on up to 4 channels can be simultaneously opened and these channels are numbered 0 to 3.  Note that sockets with different modes can be opened on different channels.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Protocol
|-
| colspan="2" | Specifies which IP protocol to use&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Broadcast
|-
| colspan="2" | Allows broadcast type packets to be sent and received&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''
|}




'''Parameters'''
{| 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;" | '''SetDestination'''
|-
| colspan="2" | This is used in IP and UDP modes to set the destination of the intended data transfer.  The destination IP address needs to be set for both IP and UDP modes.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP0
|-
| colspan="2" | Specifies the first byte of an IP address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP1
|-
| colspan="2" | Specifies the second byte of an IP address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP2
|-
| colspan="2" | Specifies the third byte of an IP address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP3
|-
| colspan="2" | Specifies the fourth byte of an IP address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_Port_Hi
|-
| colspan="2" | Port High Byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_Port_Lo
|-
| colspan="2" | Port Low Byte&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''
|}


:[[Variable Types|<- STRING]] ''Property''
::''This parameter may be returned back to the caller''


:[[Variable Types|<- STRING]] ''Value''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::''This parameter may be returned back to the caller''
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetConsole'''
|-
| colspan="2" | Obtain the console instance for the TCP/IP base.&nbsp;
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




'''Return value'''
{| 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;" | '''TxStart'''
|-
| colspan="2" | This macro indicates the start of data transmission for the specified buffer.  In TCP mode, data transmission can only begin once the socket has become established.  In other modes, data transmission can occur as soon as the socket has been opened.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}


:''This call does not return a value''


{| 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;" | '''RxReadByte'''
|-
| colspan="2" | A call to this macro will return a byte of data in the reception buffer of the specified channel.  It will also internally increment a pointer to that data so that the next call to 'RxReadByte' (or any other read function) will read the next byte  &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | &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''
|}


===<span style="font-weight: normal;"><u><tt>SetMyIP</tt></u></span>===
This macro sets up the Internet E-Block's own IP address.  In most circumstances, this macro will not be required as the IP address setting in the component property page will remain constant throughout your application.


'''Parameters'''
{| 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;" | '''CreateUDPSocket'''
|-
| colspan="2" | This macro creates a socket for sending and receiving UDP data.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Src_Port_Hi
|-
| colspan="2" | Port High Byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Src_Port_Lo
|-
| colspan="2" | Port Low Byte&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''
|}


:[[Variable Types|BYTE]] ''IP0''
::First Byte of IP address


:[[Variable Types|BYTE]] ''IP1''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Second Byte of IP address
|-
| 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" | Send data&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
| colspan="2" | Data byte buffer to send&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to send&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''
|}


:[[Variable Types|BYTE]] ''IP2''
::Third Byte of IP address


:[[Variable Types|BYTE]] ''IP3''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Fourth Byte of IP address
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxMatch_6_Bytes'''
|-
| colspan="2" | This macro returns a non-zero value when the next 6 bytes of data in the specified channel's reception buffer are the same as those passed as parameters.  There are similar functions that check for 2 bytes and 4 bytes.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte1
|-
| colspan="2" | Specifies the value of the first byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte2
|-
| colspan="2" | Specifies the value of the second byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte3
|-
| colspan="2" | Specifies the value of the third byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte4
|-
| colspan="2" | Specifies the value of the fourth byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte5
|-
| colspan="2" | Specifies the value of the fifth byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte6
|-
| colspan="2" | Specifies the value of the sixth byte&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''
|}




'''Return value'''
{| 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;" | '''RxMatch_2_Bytes'''
|-
| colspan="2" | This macro returns a non-zero value when the next 2 bytes of data in the specified channel's reception buffer are the same as those passed as parameters.  There are similar functions that check for 4 bytes and 6 bytes.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte1
|-
| colspan="2" | Specifies the value of the first byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte2
|-
| colspan="2" | Specifies the value of the second byte&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''
|}


:''This call does not return a value''


{| 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;" | '''SecureClose'''
|-
| colspan="2" | Close the secure 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''
|}


===<span style="font-weight: normal;"><u><tt>TxSendString</tt></u></span>===
This macro fills the specified channel's transmit buffer with data.  It can fill the buffer with a single byte of data, or with a string of information.


'''Parameters'''
{| 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;" | '''RxReadString'''
|-
| colspan="2" | A call to this macro will return a byte of data in the reception buffer of the specified channel.  It will also internally increment a pointer to that data so that the next call to 'Rx_readbyte' (or any other read function) will read the next byte &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Length
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3


:[[Variable Types|<- STRING]] ''Data''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Data byte to append to Tx buffer.
|-
::''This parameter may be returned back to the caller''
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TxEnd'''
|-
| colspan="2" | Once the transmit buffer has been filled with data, call this macro to actually send the data.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}




'''Return value'''
{| 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 device using the Socket function and check that it is successful. &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" | &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''
|}


:''This call does not return a value''


{| 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;" | '''CreateTCPSocket'''
|-
| colspan="2" | This macro creates a socket for sending and receiving TCP data.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Src_Port_Hi
|-
| colspan="2" | Port High Byte&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Src_Port_Lo
|-
| colspan="2" | Port Low Byte&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''
|}


===<span style="font-weight: normal;"><u><tt>RxSkipBytes</tt></u></span>===
Often when receiving data packets, it may be necessary to ignore large sections of the data.  This can be achieved by reading each byte individually (and ignoring the returned data), but a better way is to use this Rx_skipbytes macro.


'''Parameters'''
{| 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;" | '''RxDataAvailable'''
|-
| colspan="2" | This macro is used to check whether or not data has been received by the Internet E-Block. A return value of zero indicated that no data has been received.  A positive return value indicates that data is available.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}


:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3


:[[Variable Types|BYTE]] ''Count''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Specifies how many bytes to skip
|-
| 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. Type =0 for TCP, =1 for UDP This must be successfully done before attempting connection with a remote destination. Returns 1 if successful, 0 if not.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Type
|-
| colspan="2" | Type of socket to create&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''
|}




'''Return value'''
{| 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;" | '''TxSendByte'''
|-
| colspan="2" | This macro fills the specified channel's transmit buffer with data.  It can fill the buffer with a single byte of data, or with a string of information.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | &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''
|}


:''This call does not return a value''


{| 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;" | '''TCPListen'''
|-
| colspan="2" | This macro puts a previously opened TCP channel in "passive open" mode.  This is the required mode when writing a TCP server application (e.g. a web server to display HTML web pages).&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}


===<span style="font-weight: normal;"><u><tt>RxReadHeader</tt></u></span>===
Once data in a particular channel has been received, the header will be filled with information about the received data.  This macro will return the information in the header.  The idx parameter specifies which byte of information in the header to read


'''Parameters'''
{| 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;" | '''RxFlushData'''
|-
| colspan="2" | Once data reception has been completed, this macro should be called to discard the data packet and allow other data packets to be read.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}


:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3


:[[Variable Types|BYTE]] ''Idx''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Specifies the byte index to return
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TCPConnect'''
|-
| colspan="2" | This macro puts a previously opened TCP channel in "active open" mode.  This is the required mode when writing a TCP client application (e.g. using SMTP to send an email).&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP0
|-
| colspan="2" | First Byte of IP address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP1
|-
| colspan="2" | Second Byte of IP address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP2
|-
| colspan="2" | Third Byte of IP address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP3
|-
| colspan="2" | Fourth Byte of IP address&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_Port_Hi
|-
| colspan="2" | High Byte of destination port&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_Port_Lo
|-
| colspan="2" | Low Byte of destination port&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''
|}




'''Return value'''
{| 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;" | '''GetPropertyVal'''
|-
| colspan="2" | &nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Property
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:[[Variable Types|BYTE]]


{| 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" | Close the socket&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''
|}


===<span style="font-weight: normal;"><u><tt>CreateIPSocket</tt></u></span>===
Note that sockets on up to 4 channels can be simultaneously opened and these channels are numbered 0 to 3.  Note that sockets with different modes can be opened on different channels.


'''Parameters'''
{| 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;" | '''SecureRead'''
|-
| colspan="2" | Attempts to read max number of bytes from the secure socket into the buffer. Returns actual number of bytes read.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | buffer
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:]] -
| width="90%" | max
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] -
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}


:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3


:[[Variable Types|BYTE]] ''Protocol''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Specifies which IP protocol to use
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxMatchMyMAC'''
|-
| colspan="2" | This macro returns a non-zero value when the next 6 bytes of data in the specified channel's reception buffer are the same as the Internet E-block's MAC address entered in the component's property page.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}


:[[Variable Types|BYTE]] ''Broadcast''
::Allows broadcast type packets to be sent and received


{| 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" | &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''
|}


'''Return value'''


:[[Variable Types|BYTE]]
{| 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;" | '''RxDataSize'''
|-
| colspan="2" | This macro is used to detect the size of data collected by the Rx_data_available macro.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}




===<span style="font-weight: normal;"><u><tt>SetDestination</tt></u></span>===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
This is used in IP and UDP modes to set the destination of the intended data transfer. The destination IP address needs to be set for both IP and UDP modes.
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TxSendMyMAC'''
|-
| colspan="2" | This macro fills the specified channel's transmit buffer with 6 bytes of data representing this Internet E-Block's MAC address as specified in the component's property page.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}


'''Parameters'''


:[[Variable Types|BYTE]] ''Channel''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Specifies the communications channel 0-3
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CreateMACSocket'''
|-
| colspan="2" | This macro creates a socket for sending and receiving Ethernet data using raw data.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Promiscuous
|-
| colspan="2" | Receive everything (1) or just data bound for your MAC (0)&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Broadcast
|-
| colspan="2" | Allows broadcast messages to be accepted (1) or rejected (0)&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Error
|-
| colspan="2" | Allowsmessages with errors to be accepted (1) or rejected (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''
|}


:[[Variable Types|BYTE]] ''Dst_IP0''
::Specifies the first byte of an IP address


:[[Variable Types|BYTE]] ''Dst_IP1''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Specifies the second byte of an IP address
|-
| 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" | Close the accept socket&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''
|}


:[[Variable Types|BYTE]] ''Dst_IP2''
::Specifies the third byte of an IP address


:[[Variable Types|BYTE]] ''Dst_IP3''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Specifies the fourth byte of an IP address
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SecureInit'''
|-
| colspan="2" | Call once to initialise the secure socket funtionality&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''
|}


:[[Variable Types|BYTE]] ''Dst_Port_Hi''
::Port High Byte


:[[Variable Types|BYTE]] ''Dst_Port_Lo''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Port Low Byte
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetSocketStatus'''
|-
| colspan="2" | This returns the state of the requested channel's socket.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}




'''Return value'''
{| 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" | Resets and initialises the Internet E-Block. It sets up the gateway address, subnet mask, device IP address and device MAC address as defined in the properties of the Flowcode component. This macro must be called before any other TCP_IP component macros &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''
|}


:''This call does not return a value''


{| 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;" | '''TCPClose'''
|-
| colspan="2" | When an established TCP connection has finished transmission of data, either the local application (i.e. your code) or the remote application (i.e. the application at the other end of the connection) can initiate closure of the socket.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}


===<span style="font-weight: normal;"><u><tt>GetConsole</tt></u></span>===
Obtain the console instance for the TCP/IP base.


'''Parameters'''
{| 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;" | '''RxMatchMyMAC'''
|-
| colspan="2" | This macro returns a non-zero value when the next 6 bytes of data in the specified channel's reception buffer are the same as the Internet E-block's MAC address entered in the component's property page.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}


:''This macro has no parameters''


{| 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;" | '''RxDataSize'''
|-
| colspan="2" | This macro is used to detect the size of data collected by the Rx_data_available macro.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}


'''Return value'''


:[[Variable Types|HANDLE]]
{| 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;" | '''TxSendMyMAC'''
|-
| colspan="2" | This macro fills the specified channel's transmit buffer with 6 bytes of data representing this Internet E-Block's MAC address as specified in the component's property page.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Specifies the communications channel 0-3&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''
|}




===<span style="font-weight: normal;"><u><tt>TxStart</tt></u></span>===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
This macro indicates the start of data transmission for the specified buffer. In TCP mode, data transmission can only begin once the socket has become established. In other modes, data transmission can occur as soon as the socket has been opened.
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CreateMACSocket'''
|-
| colspan="2" | This macro creates a socket for sending and receiving Ethernet data using raw data.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Promiscuous
|-
| colspan="2" | Receive everything (1) or just data bound for your MAC (0)&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Broadcast
|-
| colspan="2" | Allows broadcast messages to be accepted (1) or rejected (0)&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Error
|-
| colspan="2" | Allowsmessages with errors to be accepted (1) or rejected (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''
|}


'''Parameters'''
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
'''Return value'''
:''This call does not return a value''
===<span style="font-weight: normal;"><u><tt>RxReadByte</tt></u></span>===
A call to this macro will return a byte of data in the reception buffer of the specified channel.  It will also internally increment a pointer to that data so that the next call to 'RxReadByte' (or any other read function) will read the next byte
'''Parameters'''
:[[Variable Types|BYTE]] ''Channel''
'''Return value'''
:[[Variable Types|BYTE]]
===<span style="font-weight: normal;"><u><tt>CreateUDPSocket</tt></u></span>===
This macro creates a socket for sending and receiving UDP data.
'''Parameters'''
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
:[[Variable Types|BYTE]] ''Src_Port_Hi''
::Port High Byte
:[[Variable Types|BYTE]] ''Src_Port_Lo''
::Port Low Byte
'''Return value'''
:[[Variable Types|BYTE]]
===<span style="font-weight: normal;"><u><tt>RxMatch_6_Bytes</tt></u></span>===
This macro returns a non-zero value when the next 6 bytes of data in the specified channel's reception buffer are the same as those passed as parameters.  There are similar functions that check for 2 bytes and 4 bytes.
'''Parameters'''
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
:[[Variable Types|BYTE]] ''Byte1''
::Specifies the value of the first byte
:[[Variable Types|BYTE]] ''Byte2''
::Specifies the value of the second byte
:[[Variable Types|BYTE]] ''Byte3''
::Specifies the value of the third byte
:[[Variable Types|BYTE]] ''Byte4''
::Specifies the value of the fourth byte
:[[Variable Types|BYTE]] ''Byte5''
::Specifies the value of the fifth byte
:[[Variable Types|BYTE]] ''Byte6''
::Specifies the value of the sixth byte
'''Return value'''
:[[Variable Types|BYTE]]
===<span style="font-weight: normal;"><u><tt>RxMatch_2_Bytes</tt></u></span>===
This macro returns a non-zero value when the next 2 bytes of data in the specified channel's reception buffer are the same as those passed as parameters.  There are similar functions that check for 4 bytes and 6 bytes.
'''Parameters'''
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
:[[Variable Types|BYTE]] ''Byte1''
::Specifies the value of the first byte
:[[Variable Types|BYTE]] ''Byte2''
::Specifies the value of the second byte
'''Return value'''
:[[Variable Types|BYTE]]
===<span style="font-weight: normal;"><u><tt>RxReadString</tt></u></span>===
A call to this macro will return a byte of data in the reception buffer of the specified channel.  It will also internally increment a pointer to that data so that the next call to 'Rx_readbyte' (or any other read function) will read the next byte
'''Parameters'''
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
:[[Variable Types|BYTE]] ''Length''
'''Return value'''
:[[Variable Types|STRING]]
===<span style="font-weight: normal;"><u><tt>TxEnd</tt></u></span>===
Once the transmit buffer has been filled with data, call this macro to actually send the data.
'''Parameters'''
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
'''Return value'''
:''This call does not return a value''
===<span style="font-weight: normal;"><u><tt>CreateTCPSocket</tt></u></span>===
This macro creates a socket for sending and receiving TCP data.
'''Parameters'''
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
:[[Variable Types|BYTE]] ''Src_Port_Hi''
::Port High Byte
:[[Variable Types|BYTE]] ''Src_Port_Lo''
::Port Low Byte
'''Return value'''
:[[Variable Types|BYTE]]
===<span style="font-weight: normal;"><u><tt>RxDataAvailable</tt></u></span>===
This macro is used to check whether or not data has been received by the Internet E-Block. A return value of zero indicated that no data has been received.  A positive return value indicates that data is available.
'''Parameters'''
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
'''Return value'''
:[[Variable Types|BYTE]]
===<span style="font-weight: normal;"><u><tt>TxSendByte</tt></u></span>===
This macro fills the specified channel's transmit buffer with data.  It can fill the buffer with a single byte of data, or with a string of information.
'''Parameters'''
:[[Variable Types|BYTE]] ''Channel''
:[[Variable Types|BYTE]] ''Data''
'''Return value'''
:''This call does not return a value''
===<span style="font-weight: normal;"><u><tt>TCPListen</tt></u></span>===
This macro puts a previously opened TCP channel in "passive open" mode.  This is the required mode when writing a TCP server application (e.g. a web server to display HTML web pages).
'''Parameters'''
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3


 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
'''Return value'''
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
:''This call does not return a value''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Initialises the SPI connection to the TCPIP module and sets up some initial values. Flashes the LEDs on and off twice to confirm SPI comms are active. LEDs are then configured to auto functionality.&nbsp;
===<span style="font-weight: normal;"><u><tt>RxFlushData</tt></u></span>===
|-
Once data reception has been completed, this macro should be called to discard the data packet and allow other data packets to be read.
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
'''Parameters'''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>TCPConnect</tt></u></span>===
This macro puts a previously opened TCP channel in "active open" mode.  This is the required mode when writing a TCP client application (e.g. using SMTP to send an email).
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
 
:[[Variable Types|BYTE]] ''Dst_IP0''
::First Byte of IP address
 
:[[Variable Types|BYTE]] ''Dst_IP1''
::Second Byte of IP address
 
:[[Variable Types|BYTE]] ''Dst_IP2''
::Third Byte of IP address
 
:[[Variable Types|BYTE]] ''Dst_IP3''
::Fourth Byte of IP address
 
:[[Variable Types|BYTE]] ''Dst_Port_Hi''
::High Byte of destination port
 
:[[Variable Types|BYTE]] ''Dst_Port_Lo''
::Low Byte of destination port
 
 
'''Return value'''
 
:[[Variable Types|BYTE]]
 
 
===<span style="font-weight: normal;"><u><tt>GetPropertyVal</tt></u></span>===
''<span style="color:red;">No additional information</span>''
 
 
 
'''Parameters'''
 
:[[Variable Types|<- STRING]] ''Property''
::''This parameter may be returned back to the caller''
 
 
'''Return value'''
 
:[[Variable Types|STRING]]
 
 
===<span style="font-weight: normal;"><u><tt>RxMatchMyMAC</tt></u></span>===
This macro returns a non-zero value when the next 6 bytes of data in the specified channel's reception buffer are the same as the Internet E-block's MAC address entered in the component's property page.
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
 
 
'''Return value'''
 
:[[Variable Types|BYTE]]
 
 
===<span style="font-weight: normal;"><u><tt>RxDataSize</tt></u></span>===
This macro is used to detect the size of data collected by the Rx_data_available macro.
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
 
 
'''Return value'''
 
:[[Variable Types|BYTE]]
 
 
===<span style="font-weight: normal;"><u><tt>TxSendMyMAC</tt></u></span>===
This macro fills the specified channel's transmit buffer with 6 bytes of data representing this Internet E-Block's MAC address as specified in the component's property page.
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>CreateMACSocket</tt></u></span>===
This macro creates a socket for sending and receiving Ethernet data using raw data.
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''Promiscuous''
::Receive everything (1) or just data bound for your MAC (0)
 
:[[Variable Types|BYTE]] ''Broadcast''
::Allows broadcast messages to be accepted (1) or rejected (0)
 
:[[Variable Types|BYTE]] ''Error''
::Allowsmessages with errors to be accepted (1) or rejected (0)
 
 
'''Return value'''
 
:[[Variable Types|BYTE]]
 
 
===<span style="font-weight: normal;"><u><tt>GetSocketStatus</tt></u></span>===
This returns the state of the requested channel's socket.
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
 
 
'''Return value'''
 
:[[Variable Types|BYTE]]
 
 
===<span style="font-weight: normal;"><u><tt>TCPClose</tt></u></span>===
When an established TCP connection has finished transmission of data, either the local application (i.e. your code) or the remote application (i.e. the application at the other end of the connection) can initiate closure of the socket.
 
'''Parameters'''
 
:[[Variable Types|BYTE]] ''Channel''
::Specifies the communications channel 0-3
 
 
'''Return value'''
 
:''This call does not return a value''
 
 
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
Resets and initialises the Internet E-Block. It sets up the gateway address, subnet mask, device IP address and device MAC address as defined in the properties of the Flowcode component. This macro must be called before any other TCP_IP component macros
 
'''Parameters'''
 
:''This macro has no parameters''
 
 
'''Return value'''
 
:''This call does not return a value''




Line 605: Line 1,179:


==Property reference==
==Property reference==
<span style="font-weight: normal;"><u>Hostname</u></span>


This property is of type ''Line of text'' and can be referenced with the variable name ''hostname''.
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
Local PC's hostname
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
<span style="font-weight: normal;"><u>Network Interface</u></span>
|-
 
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''interface''.
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
| width="90%" | Hostname
List of network interfaces connected to the PC.  
|-
 
| colspan="2" | Local PC's hostname&nbsp;
Sets which interface we are communicating via.
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
<span style="font-weight: normal;"><u>Gateway0</u></span>
| width="90%" | Network Interface
 
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''gateway0''.
| colspan="2" | List of network interfaces connected to the PC. Sets which interface we are communicating via.&nbsp;
 
|-
Gateway IP address to the Internet, auto populated from the selected interface.
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Gateway0
<span style="font-weight: normal;"><u>Gateway1</u></span>
|-
 
| colspan="2" | Gateway IP address to the Internet, auto populated from the selected interface.&nbsp;
This property is of type ''Signed integer'' and can be referenced with the variable name ''gateway1''.
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
Gateway IP address to the Internet, auto populated from the selected interface.
| width="90%" | Gateway1
 
|-
<span style="font-weight: normal;"><u>Gateway2</u></span>
| colspan="2" | Gateway IP address to the Internet, auto populated from the selected interface.&nbsp;
 
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''gateway2''.
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Gateway2
Gateway IP address to the Internet, auto populated from the selected interface.
|-
 
| colspan="2" | Gateway IP address to the Internet, auto populated from the selected interface.&nbsp;
<span style="font-weight: normal;"><u>Gateway3</u></span>
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
This property is of type ''Signed integer'' and can be referenced with the variable name ''gateway3''.
| width="90%" | Gateway3
 
|-
Gateway IP address to the Internet, auto populated from the selected interface.
| colspan="2" | Gateway IP address to the Internet, auto populated from the selected interface.&nbsp;
 
|-
<span style="font-weight: normal;"><u>Subnet0</u></span>
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Subnet0
This property is of type ''Signed integer'' and can be referenced with the variable name ''subnet0''.
|-
 
| colspan="2" | Network IP subnet mask, auto populated from the selected interface.&nbsp;
Network IP subnet mask, auto populated from the selected interface.
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
<span style="font-weight: normal;"><u>Subnet1</u></span>
| width="90%" | Subnet1
 
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''subnet1''.
| colspan="2" | Network IP subnet mask, auto populated from the selected interface.&nbsp;
 
|-
Network IP subnet mask, auto populated from the selected interface.
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | Subnet2
<span style="font-weight: normal;"><u>Subnet2</u></span>
|-
 
| colspan="2" | Network IP subnet mask, auto populated from the selected interface.&nbsp;
This property is of type ''Signed integer'' and can be referenced with the variable name ''subnet2''.
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
Network IP subnet mask, auto populated from the selected interface.
| width="90%" | Subnet3
 
|-
<span style="font-weight: normal;"><u>Subnet3</u></span>
| colspan="2" | Network IP subnet mask, auto populated from the selected interface.&nbsp;
 
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''subnet3''.
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | IP0
Network IP subnet mask, auto populated from the selected interface.
|-
 
| colspan="2" | Network IP address, auto populated from the selected interface.&nbsp;
<span style="font-weight: normal;"><u>IP0</u></span>
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
This property is of type ''Signed integer'' and can be referenced with the variable name ''ip0''.
| width="90%" | IP1
 
|-
Network IP address, auto populated from the selected interface.
| colspan="2" | Network IP address, auto populated from the selected interface.&nbsp;
 
|-
<span style="font-weight: normal;"><u>IP1</u></span>
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | IP2
This property is of type ''Signed integer'' and can be referenced with the variable name ''ip1''.
|-
 
| colspan="2" | Network IP address, auto populated from the selected interface.&nbsp;
Network IP address, auto populated from the selected interface.
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
<span style="font-weight: normal;"><u>IP2</u></span>
| width="90%" | IP3
 
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''ip2''.
| colspan="2" | Network IP address, auto populated from the selected interface.&nbsp;
 
|-
Network IP address, auto populated from the selected interface.
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | MAC0
<span style="font-weight: normal;"><u>IP3</u></span>
|-
 
| colspan="2" | Network MAC address, auto populated from the selected interface.&nbsp;
This property is of type ''Signed integer'' and can be referenced with the variable name ''ip3''.
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
Network IP address, auto populated from the selected interface.
| width="90%" | MAC1
 
|-
<span style="font-weight: normal;"><u>MAC0</u></span>
| colspan="2" | Network MAC address, auto populated from the selected interface.&nbsp;
 
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''mac0''.
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | MAC2
Network MAC address, auto populated from the selected interface.
|-
 
| colspan="2" | Network MAC address, auto populated from the selected interface.&nbsp;
<span style="font-weight: normal;"><u>MAC1</u></span>
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
This property is of type ''Signed integer'' and can be referenced with the variable name ''mac1''.
| width="90%" | MAC3
 
|-
Network MAC address, auto populated from the selected interface.
| colspan="2" | Network MAC address, auto populated from the selected interface.&nbsp;
 
|-
<span style="font-weight: normal;"><u>MAC2</u></span>
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
| width="90%" | MAC4
This property is of type ''Signed integer'' and can be referenced with the variable name ''mac2''.
|-
 
| colspan="2" | Network MAC address, auto populated from the selected interface.&nbsp;
Network MAC address, auto populated from the selected interface.
|-
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
<span style="font-weight: normal;"><u>MAC3</u></span>
| width="90%" | MAC5
 
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''mac3''.
| colspan="2" | Network MAC address, auto populated from the selected interface.&nbsp;
 
|-
Network MAC address, auto populated from the selected interface.
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Console Data
<span style="font-weight: normal;"><u>MAC4</u></span>
|-
 
| colspan="2" | Generate Console Data&nbsp;
This property is of type ''Signed integer'' and can be referenced with the variable name ''mac4''.
|-
 
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
Network MAC address, auto populated from the selected interface.
| width="90%" | Target
 
|-
<span style="font-weight: normal;"><u>MAC5</u></span>
| colspan="2" | Sets a target object, to which User.Notify events will be sent when data is sent and received. Events are send with Message ID = this component's handle,  Data: 1=Send, 2=Receive.&nbsp;
 
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''mac5''.
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''
Network MAC address, auto populated from the selected interface.
|-
 
|-
<span style="font-weight: normal;"><u>Target</u></span>
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''
This property is of type ''Panel object'' and can be referenced with the variable name ''notify_target''.
|-
 
|}
Sets a target object, to which User.Notify events will be sent when data is sent and received.
 
Events are send with Message ID = this component's handle,  Data: 1=Send, 2=Receive.

Revision as of 20:58, 16 November 2021

Author Matrix Ltd.
Version 2.2
Category Comms: Networking


TCP Template component

Base TCP/IP component with simulation only interface to allow TCP/IP style network communications in simulation. Suitable for inheriting

Detailed description

No detailed description exists yet for this component

Examples

Additional examples can be found in the “Apps and Bundles” section of this Wiki:

Internet Application Guide

Wireless LAN Application Guide

Downloadable macro reference

TxSendMyIP
This macro fills the specified channel's transmit buffer with 4 bytes of data representing this Internet E-Block's IP address as specified in the component's property page. 
- BYTE Channel
Specifies the communications channel 0-3 
- VOID Return


RxMatchMyIP
This macro returns a non-zero value when the next 4 bytes of data in the specified channel's reception buffer are the same as the Internet E-block's IP address. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Return


RxMatch_4_Bytes
This macro returns a non-zero value when the next 4 bytes of data in the specified channel's reception buffer are the same as those passed as parameters. There are similar functions that check for 2 bytes and 6 bytes. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Byte1
Specifies the value of the first byte 
- BYTE Byte2
Specifies the value of the second byte 
- BYTE Byte3
Specifies the value of the third byte 
- BYTE Byte4
Specifies the value of the fourth byte 
- BYTE Return


SetPropertyVal
 
- STRING Property
 
- STRING Value
 
- VOID Return


SetMyIP
This macro sets up the Internet E-Block's own IP address. In most circumstances, this macro will not be required as the IP address setting in the component property page will remain constant throughout your application. 
- BYTE IP0
First Byte of IP address 
- BYTE IP1
Second Byte of IP address 
- BYTE IP2
Third Byte of IP address 
- BYTE IP3
Fourth Byte of IP address 
- VOID Return


TxSendString
This macro fills the specified channel's transmit buffer with data. It can fill the buffer with a single byte of data, or with a string of information. 
- BYTE Channel
Specifies the communications channel 0-3 
- STRING Data
Data byte to append to Tx buffer. 
- VOID Return


SecureWrite
Attempts to write max number of bytes to the secure socket from the buffer. Returns actual number of bytes written. 
- STRING buffer
 
[[File:]] - max
 
[[File:]] - Return


Connect
Attempt to connect to the given address and port. First open a socket on the local device using the Socket function and check that it is successful.  
- STRING Address
Remote destination address 
- UINT Port
Remote destination port 
- BYTE Return


ForcePropEvent
Allows the property event to be fired, doing things like fetching the correct IP for the network interface. 
- VOID Return


Receive
Receive data into the data buffer. Returns the number of bytes received 
- STRING Data
Data byte buffer to receive the data 
- UINT Count
Maximum number of bytes to read 
- UINT Return


SendTo
Send data to a destination host. Returns the number of bytes sent. 
- STRING Data
Data byte buffer to send 
- UINT Count
Number of bytes to send 
- STRING Address
 
- UINT Port
 
- UINT Return


SecureConnect
Connect securely to host and port. e.g. “www.bbc.co.uk:443” Returns 1 if successful, 0 if not 
- STRING host
Host:Port as string 
[[File:]] - Return


RxReadHeader
Once data in a particular channel has been received, the header will be filled with information about the received data. This macro will return the information in the header. The idx parameter specifies which byte of information in the header to read  
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Idx
Specifies the byte index to return 
- BYTE Return


RxSkipBytes
Often when receiving data packets, it may be necessary to ignore large sections of the data. This can be achieved by reading each byte individually (and ignoring the returned data), but a better way is to use this Rx_skipbytes macro. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Count
Specifies how many bytes to skip 
- VOID Return


CreateIPSocket
Note that sockets on up to 4 channels can be simultaneously opened and these channels are numbered 0 to 3. Note that sockets with different modes can be opened on different channels. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Protocol
Specifies which IP protocol to use 
- BYTE Broadcast
Allows broadcast type packets to be sent and received 
- BYTE Return


SetDestination
This is used in IP and UDP modes to set the destination of the intended data transfer. The destination IP address needs to be set for both IP and UDP modes. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Dst_IP0
Specifies the first byte of an IP address 
- BYTE Dst_IP1
Specifies the second byte of an IP address 
- BYTE Dst_IP2
Specifies the third byte of an IP address 
- BYTE Dst_IP3
Specifies the fourth byte of an IP address 
- BYTE Dst_Port_Hi
Port High Byte 
- BYTE Dst_Port_Lo
Port Low Byte 
- VOID Return


GetConsole
Obtain the console instance for the TCP/IP base. 
[[File:]] - Return


TxStart
This macro indicates the start of data transmission for the specified buffer. In TCP mode, data transmission can only begin once the socket has become established. In other modes, data transmission can occur as soon as the socket has been opened. 
- BYTE Channel
Specifies the communications channel 0-3 
- VOID Return


RxReadByte
A call to this macro will return a byte of data in the reception buffer of the specified channel. It will also internally increment a pointer to that data so that the next call to 'RxReadByte' (or any other read function) will read the next byte  
- BYTE Channel
 
- BYTE Return


CreateUDPSocket
This macro creates a socket for sending and receiving UDP data. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Src_Port_Hi
Port High Byte 
- BYTE Src_Port_Lo
Port Low Byte 
- BYTE Return


Send
Send data 
- STRING Data
Data byte buffer to send 
- UINT Count
Number of bytes to send 
- UINT Return


RxMatch_6_Bytes
This macro returns a non-zero value when the next 6 bytes of data in the specified channel's reception buffer are the same as those passed as parameters. There are similar functions that check for 2 bytes and 4 bytes. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Byte1
Specifies the value of the first byte 
- BYTE Byte2
Specifies the value of the second byte 
- BYTE Byte3
Specifies the value of the third byte 
- BYTE Byte4
Specifies the value of the fourth byte 
- BYTE Byte5
Specifies the value of the fifth byte 
- BYTE Byte6
Specifies the value of the sixth byte 
- BYTE Return


RxMatch_2_Bytes
This macro returns a non-zero value when the next 2 bytes of data in the specified channel's reception buffer are the same as those passed as parameters. There are similar functions that check for 4 bytes and 6 bytes. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Byte1
Specifies the value of the first byte 
- BYTE Byte2
Specifies the value of the second byte 
- BYTE Return


SecureClose
Close the secure connection 
- VOID Return


RxReadString
A call to this macro will return a byte of data in the reception buffer of the specified channel. It will also internally increment a pointer to that data so that the next call to 'Rx_readbyte' (or any other read function) will read the next byte  
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Length
 
- STRING Return


TxEnd
Once the transmit buffer has been filled with data, call this macro to actually send the data. 
- BYTE Channel
Specifies the communications channel 0-3 
- VOID Return


Listen
Bind the socket to a port on the local host and set to listen mode. First open a socket on the local device using the Socket function and check that it is successful.  
- UINT Port
 
- BYTE Return


CreateTCPSocket
This macro creates a socket for sending and receiving TCP data. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Src_Port_Hi
Port High Byte 
- BYTE Src_Port_Lo
Port Low Byte 
- BYTE Return


RxDataAvailable
This macro is used to check whether or not data has been received by the Internet E-Block. A return value of zero indicated that no data has been received. A positive return value indicates that data is available. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Return


SocketOpen
Attempts to create a socket on the local device. Type =0 for TCP, =1 for UDP This must be successfully done before attempting connection with a remote destination. Returns 1 if successful, 0 if not. 
- BYTE Type
Type of socket to create 
- BYTE Return


TxSendByte
This macro fills the specified channel's transmit buffer with data. It can fill the buffer with a single byte of data, or with a string of information. 
- BYTE Channel
 
- BYTE Data
 
- VOID Return


TCPListen
This macro puts a previously opened TCP channel in "passive open" mode. This is the required mode when writing a TCP server application (e.g. a web server to display HTML web pages). 
- BYTE Channel
Specifies the communications channel 0-3 
- VOID Return


RxFlushData
Once data reception has been completed, this macro should be called to discard the data packet and allow other data packets to be read. 
- BYTE Channel
Specifies the communications channel 0-3 
- VOID Return


TCPConnect
This macro puts a previously opened TCP channel in "active open" mode. This is the required mode when writing a TCP client application (e.g. using SMTP to send an email). 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Dst_IP0
First Byte of IP address 
- BYTE Dst_IP1
Second Byte of IP address 
- BYTE Dst_IP2
Third Byte of IP address 
- BYTE Dst_IP3
Fourth Byte of IP address 
- BYTE Dst_Port_Hi
High Byte of destination port 
- BYTE Dst_Port_Lo
Low Byte of destination port 
- BYTE Return


GetPropertyVal
 
- STRING Property
 
- STRING Return


SocketClose
Close the socket 
- VOID Return


SecureRead
Attempts to read max number of bytes from the secure socket into the buffer. Returns actual number of bytes read. 
- STRING buffer
 
[[File:]] - max
 
[[File:]] - Return


RxMatchMyMAC
This macro returns a non-zero value when the next 6 bytes of data in the specified channel's reception buffer are the same as the Internet E-block's MAC address entered in the component's property page. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Return


AcceptOpen
 
- BYTE Return


RxDataSize
This macro is used to detect the size of data collected by the Rx_data_available macro. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Return


TxSendMyMAC
This macro fills the specified channel's transmit buffer with 6 bytes of data representing this Internet E-Block's MAC address as specified in the component's property page. 
- BYTE Channel
Specifies the communications channel 0-3 
- VOID Return


CreateMACSocket
This macro creates a socket for sending and receiving Ethernet data using raw data. 
- BYTE Promiscuous
Receive everything (1) or just data bound for your MAC (0) 
- BYTE Broadcast
Allows broadcast messages to be accepted (1) or rejected (0) 
- BYTE Error
Allowsmessages with errors to be accepted (1) or rejected (0) 
- BYTE Return


AcceptClose
Close the accept socket 
- VOID Return


SecureInit
Call once to initialise the secure socket funtionality 
- VOID Return


GetSocketStatus
This returns the state of the requested channel's socket. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Return


Initialise
Resets and initialises the Internet E-Block. It sets up the gateway address, subnet mask, device IP address and device MAC address as defined in the properties of the Flowcode component. This macro must be called before any other TCP_IP component macros  
- VOID Return


TCPClose
When an established TCP connection has finished transmission of data, either the local application (i.e. your code) or the remote application (i.e. the application at the other end of the connection) can initiate closure of the socket. 
- BYTE Channel
Specifies the communications channel 0-3 
- VOID Return


RxMatchMyMAC
This macro returns a non-zero value when the next 6 bytes of data in the specified channel's reception buffer are the same as the Internet E-block's MAC address entered in the component's property page. 
- BYTE Channel
Specifies the communications channel 0-3 
- BYTE Return


RxDataSize
This macro is used to detect the size of data collected by the Rx_data_available macro. 
- BYTE Channel
Specifies the communications channel 0-3 
- UINT Return


TxSendMyMAC
This macro fills the specified channel's transmit buffer with 6 bytes of data representing this Internet E-Block's MAC address as specified in the component's property page. 
- BYTE Channel
Specifies the communications channel 0-3 
- VOID Return


CreateMACSocket
This macro creates a socket for sending and receiving Ethernet data using raw data. 
- BYTE Promiscuous
Receive everything (1) or just data bound for your MAC (0) 
- BYTE Broadcast
Allows broadcast messages to be accepted (1) or rejected (0) 
- BYTE Error
Allowsmessages with errors to be accepted (1) or rejected (0) 
- BYTE Return


Initialise
Initialises the SPI connection to the TCPIP module and sets up some initial values. Flashes the LEDs on and off twice to confirm SPI comms are active. LEDs are then configured to auto functionality. 
- VOID Return



Property reference

Properties
Hostname
Local PC's hostname 
Network Interface
List of network interfaces connected to the PC. Sets which interface we are communicating via. 
Gateway0
Gateway IP address to the Internet, auto populated from the selected interface. 
Gateway1
Gateway IP address to the Internet, auto populated from the selected interface. 
Gateway2
Gateway IP address to the Internet, auto populated from the selected interface. 
Gateway3
Gateway IP address to the Internet, auto populated from the selected interface. 
Subnet0
Network IP subnet mask, auto populated from the selected interface. 
Subnet1
Network IP subnet mask, auto populated from the selected interface. 
Subnet2
Network IP subnet mask, auto populated from the selected interface. 
Subnet3
Network IP subnet mask, auto populated from the selected interface. 
IP0
Network IP address, auto populated from the selected interface. 
IP1
Network IP address, auto populated from the selected interface. 
IP2
Network IP address, auto populated from the selected interface. 
IP3
Network IP address, auto populated from the selected interface. 
MAC0
Network MAC address, auto populated from the selected interface. 
MAC1
Network MAC address, auto populated from the selected interface. 
MAC2
Network MAC address, auto populated from the selected interface. 
MAC3
Network MAC address, auto populated from the selected interface. 
MAC4
Network MAC address, auto populated from the selected interface. 
MAC5
Network MAC address, auto populated from the selected interface. 
Console Data
Generate Console Data 
Target
Sets a target object, to which User.Notify events will be sent when data is sent and received. Events are send with Message ID = this component's handle, Data: 1=Send, 2=Receive. 
Connections
Simulations