static void Main(string[] args) { //uri = new string("ws://40.122.109.9:8000/index"); uri = new string("ws://localhost:8044/v1/erc20/0xD850942eF8811f2A866692A623011bDE52a462C1/transfers/stream/42/6736040"); Parallel.For(1, 2, (i) => { wsConnector c = new wsConnector(new wsServiceHandlerFactory()); Task <int> t = c.connect(uri); t.Wait(); }); System.Threading.AutoResetEvent ev = new System.Threading.AutoResetEvent(false); ev.WaitOne(); }
static void Main(string[] args) { //uri = new string("ws://40.122.109.9:8000/index"); //uri = new string("ws://localhost:8001/demo"); //Task.Run( async () => //{ Parallel.For(1, 2, async(i) => { var tasks = new List <Task>(); foreach (string uri in args) { wsConnector c = new wsConnector(new wsClientApp(args)); tasks.Add(c.connect(uri)); } await Task.WhenAll(tasks.ToArray()); }); //}); System.Threading.AutoResetEvent ev = new System.Threading.AutoResetEvent(false); ev.WaitOne(); }