====== TCP Socket Multiplexing ====== One very useful functionality offered by the CommandFusion [[hardware:lan-bridge|LAN Bridge]] is the ability to multiplex a TCP server socket to allow multiple client connections. Basically this means devices that traditionally only accept a single connection at a time over TCP can be extended to allow multiple clients (iPads, control systems, etc) to connect simultaneously. ===== Examples of Uses ===== Allowing multiple TCP Client connections to: * Clipsal CNI (ethernet interface to the Clipsal C-Bus network) * Global Cache GC-100 units (iTach units allow multiple connections natively). * Crestron TCP Server symbol {{:software:system-commander:multiplexing_diagram.svg|}} ===== How To Configure Multiplexing ===== Once you have the LAN Bridge [[software:system-commander:device-discovery|discovered]] in System Commander, select the 'Slots' tab.\\ This tab page contains all the settings to configure communication slots and bridges required to configure multiplexing. ==== Configure the Communication Slots ==== The first step is to create the configuration slots. You will need two slots defined for each TCP Socket you wish to multiplex: - The TCP Client slot - this is used to communicate from the LAN Bridge to the target device (Clipsal CNI for example). - The TCP Server slot - this is used to communicate from the LAN Bridge to the multiple devices (iPads, etc) wanting to communicate to the target device. {{ :software:system-commander:multiplexing_slots.png?nolink |}} - Slot #13 configured as a TCP Client - the connection to the target device - Enter the IP address of the target device - Enter the port number of the TCP socket that the target device is listening on. This port depends entirely on how the third party device communicates. 10001 is just an example. - The LAN Bridge shares a maximum of 25 simultaneous connections across any defined slots. Each TCP Client counts as 1 connection, whilst each incoming connection to TCP Server slots counts as another connection. - Slot #14 configured as a TCP Server - the connection to each iPad, etc - Enter IP address of 0.0.0.0 to allow any client IP address to connect - Enter a port number that all clients (iPads, etc) will use to connect. This can be any port number you desire, just so long as you use the same port in both the LAN Bridge config and your guiDesigner system. ==== Bridge the Communication Slots ==== Now that we have both the communication slots defined, we need to bridge their communications. This means any data sent to the TCP Server slot will be forwarded to the TCP Client slot, and vice-versa. In the Slot Bridging grid, find the slot number for the two communication slots defined earlier. Then in the destination slot, choose the slot number for the corresponding communication slot.\\ Both slots need to be bridged, otherwise data will only be bridged one way, and not the other. {{ :software:system-commander:multiplexing_bridging.png?nolink |}} - Bridging data coming from slot #13 (Clipsal CNI in this case) - Data received on slot #13 will be bridged (forwarded) to slot #14 (any TCP Clients connected to the server, iPads, etc) - Bridging data coming from slot #14 (TCP Clients, iPads, etc) - Data received on slot #14 will be bridged (forwarded) to slot #13 (Clipsal CNI in this case) ==== Save and Reset ==== Before changes to communication slots become active, you need to save them to the LAN Bridge by pressing the 'Save' button next to the relevant sections of System Commander.\\ You will also need to reset the LAN Bridge for communication slot changes to become active. After the changes are saved and the LAN Bridge has been reset, the last step is to change the configuration on your TCP Clients (iPads, etc) to communicate to the LAN Bridge instead of directly to the target device.\\ In this example, the iPads would be changed to communicate to the IP of the LAN Bridge on TCP port 10004. Now you can have multiple devices connecting and communicating with a single TCP Server at once, bypassing and single connection limitations of the target device.