Jump to content

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

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(8 intermediate revisions by 2 users not shown)
Line 77: Line 77:


[[Wireless_LAN_Application_Guide | Wireless LAN Application Guide]]
[[Wireless_LAN_Application_Guide | Wireless LAN Application Guide]]




Line 84: Line 90:
==Macro reference==
==Macro reference==


===TxSendMyIP===
===AcceptClose===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''AcceptClose'''
|-
| colspan="2" | Close the accept socket 
|-
|-
| 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" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===AcceptOpen===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''AcceptOpen'''
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| colspan="2" |  
| 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="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===RxMatchMyIP===
===Connect===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''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.  
|-
|-
| 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. 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Address
|-
|-
| colspan="2" | Remote destination address 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Channel
| width="90%" | Port
|-
|-
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" | Remote destination port 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 122: Line 142:




===RxMatch_4_Bytes===
===CreateIPSocket===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxMatch_4_Bytes'''
| width="90%" class="mtx-class-macrohead" | '''CreateIPSocket'''
|-
|-
| 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 parametersThere are similar functions that check for 2 bytes and 6 bytes. 
| colspan="2" | Note that sockets on up to 4 channels can be simultaneously opened and these channels are numbered 0 to 3Note that sockets with different modes can be opened on different channels. 
|-
|-
|-
|-
Line 137: Line 157:
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte1
| width="90%" | Protocol
|-
| colspan="2" | Specifies which IP protocol to use 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Broadcast
|-
| colspan="2" | Allows broadcast type packets to be sent and received 
|-
| 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''
|}
 
 
===CreateMACSocket===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''CreateMACSocket'''
|-
| colspan="2" | This macro creates a socket for sending and receiving Ethernet data using raw data. 
|-
|-
| colspan="2" | Specifies the value of the first byte 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte2
| width="90%" | Promiscuous
|-
|-
| colspan="2" | Specifies the value of the second byte 
| colspan="2" | Receive everything (1) or just data bound for your MAC (0) 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte3
| width="90%" | Broadcast
|-
|-
| colspan="2" | Specifies the value of the third byte 
| colspan="2" | Allows broadcast messages to be accepted (1) or rejected (0) 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte4
| width="90%" | Error
|-
|-
| colspan="2" | Specifies the value of the fourth byte 
| colspan="2" | Allowsmessages with errors to be accepted (1) or rejected (0) 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 161: Line 200:




===SetPropertyVal===
===CreateTCPSocket===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''CreateTCPSocket'''
|-
| colspan="2" | This macro creates a socket for sending and receiving TCP data. 
|-
|-
| 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" |  
| 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" | [[File:Fc9-string-icon.png]] - STRING
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Property
| width="90%" | Src_Port_Hi
|-
|-
| colspan="2" |  
| colspan="2" | Port High Byte 
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Value
| width="90%" | Src_Port_Lo
|-
|-
| colspan="2" |  
| colspan="2" | Port Low Byte 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===SetMyIP===
===CreateUDPSocket===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetMyIP'''
| width="90%" class="mtx-class-macrohead" | '''CreateUDPSocket'''
|-
|-
| 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. 
| colspan="2" | This macro creates a socket for sending and receiving UDP data. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP0
| width="90%" | Channel
|-
|-
| colspan="2" | First Byte of IP address 
| colspan="2" | Specifies the communications channel 0-3 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP1
| width="90%" | Src_Port_Hi
|-
|-
| colspan="2" | Second Byte of IP address 
| colspan="2" | Port High Byte 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP2
| width="90%" | Src_Port_Lo
|-
|-
| colspan="2" | Third Byte of IP address 
| colspan="2" | Port Low Byte 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP3
|-
| colspan="2" | Fourth Byte of IP address 
|-
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===TxSendString===
===ForcePropEvent===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TxSendString'''
| width="90%" class="mtx-class-macrohead" | '''ForcePropEvent'''
|-
|-
| 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. 
| colspan="2" | Allows the property event to be fired, doing things like fetching the correct IP for the network interface. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" | Channel
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===GetConsole===
{| class="mtx-class-macrotable wikitable"
|-
|-
| colspan="2" | Specifies the communications channel 0-3 
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''GetConsole'''
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| colspan="2" | Obtain the console instance for the TCP/IP base. 
| width="90%" | Data
|-
|-
| colspan="2" | Data byte to append to Tx buffer. 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-h32-icon.png]] - HANDLE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===SecureWrite===
===GetPropertyVal===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SecureWrite'''
| width="90%" class="mtx-class-macrohead" | '''GetPropertyVal'''
|-
|-
| colspan="2" | Attempts to write max number of bytes to the secure socket from the buffer. Returns actual number of bytes written. 
| colspan="2" |  
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | buffer
| width="90%" | Property
|-
|-
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | max
|-
| colspan="2" |  
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===Connect===
===GetSocketStatus===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connect'''
| width="90%" class="mtx-class-macrohead" | '''GetSocketStatus'''
|-
|-
| 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.  
| colspan="2" | This returns the state of the requested channel's socket. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Address
| width="90%" | Channel
|-
|-
| colspan="2" | Remote destination address 
| colspan="2" | Specifies the communications channel 0-3 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" | Remote destination port 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 291: Line 324:




===ForcePropEvent===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ForcePropEvent'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Allows the property event to be fired, doing things like fetching the correct IP for the network interface. 
| 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  
|-
|-
|-
|-
Line 305: Line 338:




===Receive===
===Listen===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Receive'''
| width="90%" class="mtx-class-macrohead" | '''Listen'''
|-
|-
| colspan="2" | Receive data into the data buffer. Returns the number of bytes received 
| 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.  
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
|-
| colspan="2" | Data byte buffer to receive the data 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
| width="90%" | Port
|-
|-
| colspan="2" | Maximum number of bytes to read 
| colspan="2" |  
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===SendTo===
===Receive===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendTo'''
| width="90%" class="mtx-class-macrohead" | '''Receive'''
|-
|-
| colspan="2" | Send data to a destination host. Returns the number of bytes sent. 
| colspan="2" | Receive data into the data buffer. Returns the number of bytes received 
|-
|-
|-
|-
Line 341: Line 369:
| width="90%" | Data
| width="90%" | Data
|-
|-
| colspan="2" | Data byte buffer to send 
| colspan="2" | Data byte buffer to receive the data 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
| width="90%" | Count
|-
|-
| colspan="2" | Number of bytes to send 
| colspan="2" | Maximum number of bytes to read 
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Address
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Port
|-
| colspan="2" |  
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
Line 363: Line 381:




===SecureConnect===
===RxDataAvailable===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SecureConnect'''
| width="90%" class="mtx-class-macrohead" | '''RxDataAvailable'''
|-
|-
| colspan="2" | Connect securely to host and port. e.g. “www.bbc.co.uk:443” Returns 1 if successful, 0 if not 
| 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. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | host
| width="90%" | Channel
|-
|-
| colspan="2" | Host:Port as string 
| colspan="2" | Specifies the communications channel 0-3 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===RxReadHeader===
===RxDataSize===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxReadHeader'''
| width="90%" class="mtx-class-macrohead" | '''RxDataSize'''
|-
|-
| 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  
| colspan="2" | This macro is used to detect the size of data collected by the Rx_data_available macro. 
|-
|-
|-
|-
Line 395: Line 413:
|-
|-
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" | Specifies the communications channel 0-3 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Idx
|-
| colspan="2" | Specifies the byte index to return 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 406: Line 419:




===RxSkipBytes===
===RxFlushData===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxSkipBytes'''
| width="90%" class="mtx-class-macrohead" | '''RxFlushData'''
|-
|-
| 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. 
| 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. 
|-
|-
|-
|-
Line 419: Line 432:
|-
|-
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" | Specifies the communications channel 0-3 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Count
|-
| colspan="2" | Specifies how many bytes to skip 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 430: Line 438:




===CreateIPSocket===
===RxMatchMyIP===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CreateIPSocket'''
| width="90%" class="mtx-class-macrohead" | '''RxMatchMyIP'''
|-
|-
| 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. 
| 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. 
|-
|-
|-
|-
Line 443: Line 451:
|-
|-
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" | Specifies the communications channel 0-3 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Protocol
|-
| colspan="2" | Specifies which IP protocol to use 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Broadcast
|-
| colspan="2" | Allows broadcast type packets to be sent and received 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 459: Line 457:




===SetDestination===
===RxMatchMyMAC===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetDestination'''
| width="90%" class="mtx-class-macrohead" | '''RxMatchMyMAC'''
|-
|-
| 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. 
| 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. 
|-
|-
|-
|-
Line 473: Line 471:
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" | Specifies the communications channel 0-3 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP0
|-
| colspan="2" | Specifies the first byte of an IP address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP1
|-
| colspan="2" | Specifies the second byte of an IP address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP2
|-
| colspan="2" | Specifies the third byte of an IP address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP3
|-
| colspan="2" | Specifies the fourth byte of an IP address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_Port_Hi
|-
| colspan="2" | Port High Byte 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_Port_Lo
|-
| colspan="2" | Port Low Byte 
|-
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===GetConsole===
===RxMatch_2_Bytes===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetConsole'''
| width="90%" class="mtx-class-macrohead" | '''RxMatch_2_Bytes'''
|-
|-
| colspan="2" | Obtain the console instance for the TCP/IP base. 
| 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 parametersThere are similar functions that check for 4 bytes and 6 bytes. 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-h32-icon.png]] - HANDLE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===TxStart===
{| 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 establishedIn other modes, data transmission can occur as soon as the socket has been opened. 
|-
|-
|-
|-
Line 536: Line 490:
| colspan="2" | Specifies the communications channel 0-3 
| 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="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | Byte1
|}
 
 
===RxReadByte===
{| 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   
|-
|-
| colspan="2" | Specifies the value of the first byte 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
| width="90%" | Byte2
|-
|-
| colspan="2" |  
| colspan="2" | Specifies the value of the second byte 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 560: Line 505:




===CreateUDPSocket===
===RxMatch_4_Bytes===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CreateUDPSocket'''
| width="90%" class="mtx-class-macrohead" | '''RxMatch_4_Bytes'''
|-
|-
| colspan="2" | This macro creates a socket for sending and receiving UDP data. 
| 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. 
|-
|-
|-
|-
Line 575: Line 520:
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Src_Port_Hi
| width="90%" | Byte1
|-
|-
| colspan="2" | Port High Byte 
| colspan="2" | Specifies the value of the first byte 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Src_Port_Lo
| width="90%" | Byte2
|-
|-
| colspan="2" | Port Low Byte 
| colspan="2" | Specifies the value of the second byte 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | Byte3
|}
 
 
===Send===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | Specifies the value of the third byte 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Send'''
|-
|-
| colspan="2" | Send data 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte4
|-
|-
| colspan="2" | Specifies the value of the fourth byte 
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | Data byte buffer to send 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Count
|-
| colspan="2" | Number of bytes to send 
|-
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}
Line 614: Line 545:


===RxMatch_6_Bytes===
===RxMatch_6_Bytes===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxMatch_6_Bytes'''
| width="90%" class="mtx-class-macrohead" | '''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. 
| 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. 
Line 662: Line 593:




===RxMatch_2_Bytes===
===RxReadByte===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxMatch_2_Bytes'''
| width="90%" class="mtx-class-macrohead" | '''RxReadByte'''
|-
|-
| 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 parametersThere are similar functions that check for 4 bytes and 6 bytes. 
| colspan="2" | A call to this macro will return a byte of data in the reception buffer of the specified channelIt 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   
|-
|-
|-
|-
Line 674: Line 605:
| width="90%" | Channel
| width="90%" | Channel
|-
|-
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte1
|-
| colspan="2" | Specifies the value of the first byte 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Byte2
|-
| colspan="2" | Specifies the value of the second byte 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 691: Line 612:




===SecureClose===
===RxReadHeader===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''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  
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | Specifies the communications channel 0-3 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SecureClose'''
|-
|-
| colspan="2" | Close the secure connection 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Idx
|-
|-
| colspan="2" | Specifies the byte index to return 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}
Line 706: Line 637:


===RxReadString===
===RxReadString===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxReadString'''
| width="90%" class="mtx-class-macrohead" | '''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  
| 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  
Line 729: Line 660:




===TxEnd===
===RxSkipBytes===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TxEnd'''
| width="90%" class="mtx-class-macrohead" | '''RxSkipBytes'''
|-
|-
| colspan="2" | Once the transmit buffer has been filled with data, call this macro to actually send the data. 
| 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. 
|-
|-
|-
|-
Line 742: Line 673:
|-
|-
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" | Specifies the communications channel 0-3 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Count
|-
| colspan="2" | Specifies how many bytes to skip 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 748: Line 684:




===SetChannel===
===SecureClose===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetChannel'''
| width="90%" class="mtx-class-macrohead" | '''SecureClose'''
|-
|-
| colspan="2" | Dictates the TCP IP channel used for socket communications allowing for multiple parrallel communication streams to co-exist, Used by the network comms component to drive the TCP IP runtime comms 
| colspan="2" | Close the secure connection 
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Channel
|-
| colspan="2" | Range: 0 to 3 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 767: Line 698:




===Listen===
===SecureConnect===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Listen'''
| width="90%" class="mtx-class-macrohead" | '''SecureConnect'''
|-
|-
| 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.  
| colspan="2" | Connect securely to host and port. e.g. “www.bbc.co.uk:443” Returns 1 if successful, 0 if not 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Port
| width="90%" | host
|-
|-
| colspan="2" |  
| colspan="2" | Host:Port as string 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===CreateTCPSocket===
===SecureInit===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SecureInit'''
|-
| colspan="2" | Call once to initialise the secure socket funtionality 
|-
|-
| 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. 
| 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''
|}
 
 
===SecureRead===
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SecureRead'''
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| colspan="2" | Attempts to read max number of bytes from the secure socket into the buffer. Returns actual number of bytes read. 
| width="90%" | Channel
|-
|-
| colspan="2" | Specifies the communications channel 0-3 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Src_Port_Hi
| width="90%" | buffer
|-
|-
| colspan="2" | Port High Byte 
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" | Src_Port_Lo
| width="90%" | max
|-
|-
| colspan="2" | Port Low Byte 
| colspan="2" |  
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===RxDataAvailable===
===SecureWrite===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SecureWrite'''
|-
| colspan="2" | Attempts to write max number of bytes to the secure socket from the buffer. Returns actual number of bytes written. 
|-
|-
| 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. 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | buffer
|-
|-
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" | Channel
| width="90%" | max
|-
|-
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" |  
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===SocketOpen===
===Send===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''Send'''
|-
| colspan="2" | Send data 
|-
|-
| 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. 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
|-
| colspan="2" | Data byte buffer to send 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Type
| width="90%" | Count
|-
|-
| colspan="2" | Type of socket to create 
| colspan="2" | Number of bytes to send 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===TxSendByte===
===SendTo===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TxSendByte'''
| width="90%" class="mtx-class-macrohead" | '''SendTo'''
|-
|-
| 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. 
| colspan="2" | Send data to a destination host. Returns the number of bytes sent. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Channel
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
| width="90%" | Data
|-
|-
| colspan="2" |  
| colspan="2" | Data byte buffer to send 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | Count
|}
 
 
===TCPListen===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | Number of bytes to send 
| 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). 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Address
|-
|-
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Channel
| width="90%" | Port
|-
|-
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" |  
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===RxFlushData===
===SetChannel===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxFlushData'''
| width="90%" class="mtx-class-macrohead" | '''SetChannel'''
|-
|-
| 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. 
| colspan="2" | Dictates the TCP IP channel used for socket communications allowing for multiple parrallel communication streams to co-exist, Used by the network comms component to drive the TCP IP runtime comms 
|-
|-
|-
|-
Line 908: Line 849:
| width="90%" | Channel
| width="90%" | Channel
|-
|-
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" | Range: 0 to 3 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 915: Line 856:




===TCPConnect===
===SetDestination===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TCPConnect'''
| width="90%" class="mtx-class-macrohead" | '''SetDestination'''
|-
|-
| colspan="2" | This macro puts a previously opened TCP channel in "active open" modeThis is the required mode when writing a TCP client application (e.g. using SMTP to send an email). 
| colspan="2" | This is used in IP and UDP modes to set the destination of the intended data transferThe destination IP address needs to be set for both IP and UDP modes. 
|-
|-
|-
|-
Line 932: Line 873:
| width="90%" | Dst_IP0
| width="90%" | Dst_IP0
|-
|-
| colspan="2" | First Byte of IP address 
| colspan="2" | Specifies the first byte of an IP address 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP1
| width="90%" | Dst_IP1
|-
|-
| colspan="2" | Second Byte of IP address 
| colspan="2" | Specifies the second byte of an IP address 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP2
| width="90%" | Dst_IP2
|-
|-
| colspan="2" | Third Byte of IP address 
| colspan="2" | Specifies the third byte of an IP address 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP3
| width="90%" | Dst_IP3
|-
|-
| colspan="2" | Fourth Byte of IP address 
| colspan="2" | Specifies the fourth byte of an IP address 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_Port_Hi
| width="90%" | Dst_Port_Hi
|-
|-
| colspan="2" | High Byte of destination port 
| colspan="2" | Port High Byte 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_Port_Lo
| width="90%" | Dst_Port_Lo
|-
|-
| colspan="2" | Low Byte of destination port 
| colspan="2" | Port Low Byte 
|-
| 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''
|}
 
 
===SetMyIP===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''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. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP0
|-
| colspan="2" | First Byte of IP address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP1
|-
| colspan="2" | Second Byte of IP address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP2
|-
| colspan="2" | Third Byte of IP address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | IP3
|-
| colspan="2" | Fourth Byte of IP address 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===GetPropertyVal===
===SetPropertyVal===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetPropertyVal'''
| width="90%" class="mtx-class-macrohead" | '''SetPropertyVal'''
|-
|-
| colspan="2" |  
| colspan="2" |  
Line 978: Line 953:
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Value
|-
| colspan="2" |  
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}
Line 984: Line 964:


===SocketClose===
===SocketClose===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SocketClose'''
| width="90%" class="mtx-class-macrohead" | '''SocketClose'''
|-
|-
| colspan="2" | Close the socket 
| colspan="2" | Close the socket 
Line 997: Line 977:




===SecureRead===
===SocketOpen===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SecureRead'''
| width="90%" class="mtx-class-macrohead" | '''SocketOpen'''
|-
|-
| colspan="2" | Attempts to read max number of bytes from the secure socket into the buffer. Returns actual number of bytes read. 
| 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. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | buffer
| width="90%" | Type
|-
|-
| colspan="2" |  
| colspan="2" | Type of socket to create 
|-
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | max
|-
| colspan="2" |  
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===RxMatchMyMAC===
===TCPClose===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxMatchMyMAC'''
| width="90%" class="mtx-class-macrohead" | '''TCPClose'''
|-
|-
| 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. 
| 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. 
|-
|-
|-
|-
Line 1,035: Line 1,010:
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" | Specifies the communications channel 0-3 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===AcceptOpen===
===TCPConnect===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''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). 
|-
|-
| 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" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP0
|-
| colspan="2" | First Byte of IP address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP1
|-
| colspan="2" | Second Byte of IP address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP2
|-
| colspan="2" | Third Byte of IP address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_IP3
|-
| colspan="2" | Fourth Byte of IP address 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_Port_Hi
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| colspan="2" | High Byte of destination port 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AcceptOpen'''
|-
|-
| colspan="2" |  
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Dst_Port_Lo
|-
|-
| colspan="2" | Low Byte of destination port 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 1,054: Line 1,064:




===RxDataSize===
===TCPListen===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RxDataSize'''
| width="90%" class="mtx-class-macrohead" | '''TCPListen'''
|-
|-
| colspan="2" | This macro is used to detect the size of data collected by the Rx_data_available macro. 
| 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). 
|-
|-
|-
|-
Line 1,068: Line 1,078:
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" | Specifies the communications channel 0-3 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===TxSendMyMAC===
===TxEnd===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TxSendMyMAC'''
| width="90%" class="mtx-class-macrohead" | '''TxEnd'''
|-
|-
| 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. 
| colspan="2" | Once the transmit buffer has been filled with data, call this macro to actually send the data. 
|-
|-
|-
|-
Line 1,092: Line 1,102:




===CreateMACSocket===
===TxSendByte===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CreateMACSocket'''
| width="90%" class="mtx-class-macrohead" | '''TxSendByte'''
|-
|-
| colspan="2" | This macro creates a socket for sending and receiving Ethernet data using raw data. 
| 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. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Promiscuous
| width="90%" | Channel
|-
|-
| colspan="2" | Receive everything (1) or just data bound for your MAC (0) 
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Broadcast
| width="90%" | Data
|-
|-
| colspan="2" | Allows broadcast messages to be accepted (1) or rejected (0) 
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" | Error
|-
| colspan="2" | Allowsmessages with errors to be accepted (1) or rejected (0) 
|-
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===AcceptClose===
===TxSendMyIP===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''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" 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 
| 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="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 1,135: Line 1,145:




===SecureInit===
===TxSendMyMAC===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''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. 
|-
|-
| 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 
| 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="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 1,149: Line 1,164:




===GetSocketStatus===
===TxSendString===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetSocketStatus'''
| width="90%" class="mtx-class-macrohead" | '''TxSendString'''
|-
|-
| colspan="2" | This returns the state of the requested channel's socket. 
| 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. 
|-
|-
|-
|-
Line 1,163: Line 1,178:
| colspan="2" | Specifies the communications channel 0-3 
| colspan="2" | Specifies the communications channel 0-3 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" | Data
|}
 
 
===Initialise===
{| 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  
|-
|-
| colspan="2" | Data byte to append to Tx buffer. 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 1,182: Line 1,188:




===TCPClose===
===TxStart===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TCPClose'''
| width="90%" class="mtx-class-macrohead" | '''TxStart'''
|-
|-
| 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. 
| 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. 
|-
|-
|-
|-
Line 1,199: Line 1,205:
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
Line 1,221: Line 1,225:
| colspan="2" | List of network interfaces connected to the PC.  Sets which interface we are communicating via. 
| colspan="2" | List of network interfaces connected to the PC.  Sets which interface we are communicating via. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Gateway IP
| width="90%" class="mtx-class-propfolder" | Gateway IP
|-
|-
|-
|-
Line 1,245: Line 1,249:
| colspan="2" | 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. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Subnet Mask
| width="90%" class="mtx-class-propfolder" | Subnet Mask
|-
|-
|-
|-
Line 1,269: Line 1,273:
| colspan="2" | Network IP subnet mask, auto populated from the selected interface. 
| colspan="2" | Network IP subnet mask, auto populated from the selected interface. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | IP Address
| width="90%" class="mtx-class-propfolder" | IP Address
|-
|-
|-
|-
Line 1,293: Line 1,297:
| colspan="2" | Network IP address, auto populated from the selected interface. 
| colspan="2" | Network IP address, auto populated from the selected interface. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | MAC Address
| width="90%" class="mtx-class-propfolder" | MAC Address
|-
|-
|-
|-
Line 1,327: Line 1,331:
| colspan="2" | Network MAC address, auto populated from the selected interface. 
| colspan="2" | Network MAC address, auto populated from the selected interface. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Notify
| width="90%" class="mtx-class-propfolder" | Notify
|-
|-
|-
|-

Latest revision as of 14:37, 13 July 2026

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

Component Source Code

Please click here to download the component source project: FC_Comp_Source_TCPIP_Base.fcfx

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

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






Macro reference

AcceptClose

AcceptClose
Close the accept socket 
- VOID Return


AcceptOpen

AcceptOpen
 
- BYTE Return


Connect

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


CreateIPSocket

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


CreateMACSocket

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


CreateTCPSocket

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


CreateUDPSocket

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


ForcePropEvent

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


GetConsole

GetConsole
Obtain the console instance for the TCP/IP base. 
- HANDLE Return


GetPropertyVal

GetPropertyVal
 
- STRING Property
 
- STRING Return


GetSocketStatus

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


Initialise

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


Listen

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


Receive

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


RxDataAvailable

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


RxDataSize

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


RxFlushData

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


RxMatchMyIP

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


RxMatchMyMAC

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


RxMatch_2_Bytes

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


RxMatch_4_Bytes

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


RxMatch_6_Bytes

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


RxReadByte

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


RxReadHeader

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


RxReadString

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


RxSkipBytes

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


SecureClose

SecureClose
Close the secure connection 
- VOID Return


SecureConnect

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 
- INT Return


SecureInit

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


SecureRead

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


SecureWrite

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


Send

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


SendTo

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


SetChannel

SetChannel
Dictates the TCP IP channel used for socket communications allowing for multiple parrallel communication streams to co-exist, Used by the network comms component to drive the TCP IP runtime comms 
- BYTE Channel
Range: 0 to 3 
- VOID Return


SetDestination

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


SetMyIP

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


SetPropertyVal

SetPropertyVal
 
- STRING Property
 
- STRING Value
 
- VOID Return


SocketClose

SocketClose
Close the socket 
- VOID Return


SocketOpen

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


TCPClose

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


TCPConnect

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


TCPListen

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


TxEnd

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


TxSendByte

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


TxSendMyIP

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


TxSendMyMAC

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


TxSendString

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


TxStart

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


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. 
Gateway IP
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. 
Subnet Mask
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. 
IP Address
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. 
MAC Address
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. 
Notify
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.