《Microsoft Visual C# .NET 2003开发技巧大全》源代码

源代码在线查看: 15.6.txt

软件大小: 95 K
上传用户: bobey
关键词: Microsoft Visual 2003 NET
下载地址: 免注册下载 普通下载 VIP

相关代码

				Listing 15.6 Communicating with a Remote Server
				// Get the stream
				Stream s;
				try
				{
				s = client.GetStream();
				}
				catch (InvalidOperationException exc)
				{
				Console.WriteLine(“Cannot connect to {0}: {1}”,
				gameServer, exc.Message);
				return;
				}
				Console.WriteLine( “Connected to game server” );
				string response = GetResponse(s);
				Console.WriteLine( “Response\r\n--------\r\nCode: {0} Message: {1} “,
				GetResponseCode(response), GetResponseData(response));
				// connected begin game
				StartGame( s );
				client.Close();
				// Wait for user response to exit
				Console.WriteLine(“Press Return to exit”);
				Console.Read();
				client.Close();
				}
							

相关资源