参考一下微软提供的QuickStart中的一个例子:
http://chs.gotdotnet.com/QuickStart/howto/default.aspx?url=/quickstart/howto/doc/TCPUDP/DateTimeServer.aspx