/// <summary> /// Create the tcp client /// </summary> /// <param name="reactiveTableProcessor"></param> /// <param name="wireTable"></param> /// <param name="processorState"></param> /// <param name="endPoint"></param> public ReactiveTableTcpClient(IReactiveTableProcessor <TTable> reactiveTableProcessor, TTable wireTable, object processorState, IPEndPoint endPoint) { _reactiveTableProcessor = reactiveTableProcessor; _wireTable = wireTable; _processorState = processorState; _endPoint = endPoint; }
private void SetupClientCcyPairServer(IWritableReactiveTable clientsTable, IReactiveTableProcessor <IWritableReactiveTable> tableDecoder) { clientsTable.Subscribe(update => Console.WriteLine("Server side: " + update.ToString())); // Used non-batched pass through as we won't be receiving much data. var server = new ReactiveTableTcpServer <IWritableReactiveTable>( () => tableDecoder, new IPEndPoint(IPAddress.Loopback, (int)ServerPorts.BrokerFeedClients), _finished, s => clientsTable); // Start the server in a new thread Task.Run(() => server.Start(GetDecoderState())); }
private void SetupFeedSubscription(IReactiveTable currenciesTable, IReactiveTableProcessor <IReactiveTable> encoder) { var endPoint = new IPEndPoint(IPAddress.Loopback, (int)ServerPorts.BrokerFeedClients); var selectedCurrencies = new FilteredTable( currenciesTable, new DelegatePredicate1 <bool>(BrokerTableDefinition.BrokerClientColumns.ClientSide.Selected, selected => selected)); var client = new ReactiveTableTcpClient <IReactiveTable>(encoder, selectedCurrencies, GetEncoderState(), endPoint); _ccyPairSubscriptionClient = client; try { client.Start(); } catch (Exception ex) { Debug.WriteLine(ex); } }
private void SetupFeedServer(IReactiveTable feedsAndClients, ReactiveBatchedPassThroughTable feedsTable, IReactiveTableProcessor <IReactiveTable> tableEncoder) { // feedsAndClients.Subscribe(update => Console.WriteLine(update.ToString())); var server = new ReactiveTableTcpServer <IReactiveTable>(() => tableEncoder, new IPEndPoint(IPAddress.Loopback, (int)ServerPorts.BrokerFeed), _finished, s => FilterFeedsForClientTable(s, feedsAndClients), () => UpdateClients(feedsTable)); // Start the server in a new thread Task.Run(() => server.Start(GetEncoderState())); }
private void StartReceiving(IWritableReactiveTable wireTable, Dictionary <string, int> columnsToFieldIds, int port, IReactiveTableProcessor <IWritableReactiveTable> decoder) { var endPoint = new IPEndPoint(IPAddress.Loopback, port); var client = new ReactiveTableTcpClient <IWritableReactiveTable>(decoder, wireTable, GetDecoderState(columnsToFieldIds), endPoint); _feedClient = client; try { client.Start(); } catch (Exception ex) { Debug.WriteLine(ex); } }