public void connectSync() { EReaderMonitorSignal signal_ = new EReaderMonitorSignal(); Wotan.client client_ = new Wotan.client(signal_, new dispatchDelegate((twsMessage m) => {}), new logDelegate((string m, logType l, verbosity v, int id) => { }), false); if (!client_.socket.IsConnected()) { client_.socket.eConnect("127.0.0.1", 4001, 0); EReader reader = new EReader(client_.socket, signal_); reader.Start(); new Thread(() => { while (client_.socket.IsConnected()) { signal_.waitForSignal(); reader.processMsgs(); } }) { Name = "reading thread", IsBackground = true }.Start(); Thread.Sleep(1000); client_.socket.eDisconnect(); } }
public void connectAsync() { bool result = false; EReaderMonitorSignal signal_ = new EReaderMonitorSignal(); Wotan.client client_ = null; EReader reader_ = null; client_ = new Wotan.client( signal_, new dispatchDelegate((twsMessage m) => { result = true; }), new logDelegate((string m, logType l, verbosity v, int id) => { }), true); reader_ = new EReader(client_.socket, signal_); reader_.Start(); client_.connectAck(); Thread.Sleep(1000); new Thread(() => { while (client_.socket.IsConnected()) { signal_.waitForSignal(); reader_.processMsgs(); } }) { Name = "reading thread", IsBackground = true }.Start(); Thread.Sleep(10000); }
} // for designer only public serviceImpl(string[] args) : base(args) { client_ = null; logger_ = null; }