/// <summary> /// 建立socket连接 /// </summary> private void ConnectSocketServer() { DateTime dtStart = DateTime.Now; _dataQuery = DataAccess.IDataQuery; _heartRealTime = new ReqHeartDataPacket(); _heartInfo = new ReqInfoHeart(); _heartOrg = new ReqHeartOrgDataPacket(); _heartOcean = new ReqOceanHeartDataPacket(); SocketConnections = new Dictionary <TcpService, SocketConnection>(5); CreateRealTimeSocket(); CreateHistorySocket(); //CreateInfoSocket(); CreateOceanSocket(); CreateOrgSocket(); CreateLowsOrgSocket(); Timer timerCheck = new Timer(65000); timerCheck.Elapsed += timerCheck_Elapsed; timerCheck.Start(); _queryConnnection = new DataQueryConnections(_dataQuery); _queryConnnection.OnReceiveData += _queryConnnection_OnReceiveData; _indicatorQueryConnectiuon.OnReceiveData += _indicatorQueryConnectiuon_OnReceiveData; //TcpConnections = new Dictionary<short, TcpConnection>(5); //CreateRealTimeTcp(); //CreateHistoryTcp(); //CreateInfoTcp(); //CreateOrgTcp(); //CreateOceanTcp(); TimeSpan ts = DateTime.Now - dtStart; LogUtilities.LogMessage("连接服务器总共用时:" + ts.TotalMilliseconds); }
private void ConnectSocketServer(bool isDataQuery) { DateTime dtStart = DateTime.Now; _dataQuery = DataAccess.IDataQuery; DataQuery.InitQuoteReceiveDataEvent(ReceiveDataCallBack); DataQuery.InitQuoteAddConnectHandle(ConnectCallBack); DataQuery.InitQuoteConnection(); //DataQuery.InitQuoteConnectionMult(); _queryConnnection = new DataQueryConnections(_dataQuery); _queryConnnection.OnReceiveData += _queryConnnection_OnReceiveData; _indicatorQueryConnectiuon = new IndicatorQueryConnectiuon(_dataQuery); _indicatorQueryConnectiuon.OnReceiveData += _indicatorQueryConnectiuon_OnReceiveData; }