C#下用P2P技术实现点对点聊天[2]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 wlfcamal 的 blog

            // the thread.sleep that follows t.start() to see the difference.
            t.start();
            //thread.sleep(0);
    
            for (int i = 0; i < 4; i++) {
                console.writeline("main thread: do some work.");
                thread.sleep(0);
            }
    
            console.writeline("main thread: call join(), to wait until threadproc ends.");
            t.join();
            console.writeline("main thread: threadproc.join has returned.  press enter to end program.");
            console.readline();
        }
    }
    
       此代码产生的输出类似如下内容:

    main thread: start a second thread.
    main thread: do some work.
    threadproc: 0
    main thread: do some work.
    threadproc: 1
    main thread: do some work.
    threadproc: 2
    main thread: do some work.
    threadproc: 3
    main thread: call join(), to wait until threadproc ends.
    threadproc: 4
    threadproc: 5
    threadproc: 6
    threadproc: 7
    threadproc: 8
    threadproc: 9
    main thread: threadproc.join has returned.  press enter to end program.

本文关键:C#下用P2P技术实现点对点聊天
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top