如何实现100个并发连接(测试用的).
想对自己写的东西进行并发.
但是用程序 不知道怎么实现,因为在测试里面开线程,但这个还是有先后的,有没有真正实现100个并发的方法.
我的测试代码如下:
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 99; i++)
{
Thread newThread = new Thread(new ThreadStart(Program.test));
newThread.Start();
//这样创建线程执行 还是有先后,达不到并发目的啊,怎么才能让他们能真正并发.
}
}
static void test()
{
Console.WriteLine("hello");
}
}