⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 26.7.txt

📁 《Microsoft Visual C# .NET 2003开发技巧大全》源代码
💻 TXT
字号:
Listing 26.7 Connecting and Communicating with Infrared Clients
void ListenerThreadMethod()
{
int bytesRead = 0;
IrDAClient client = null; // the connecting client
Stream byteStream = null;
byte[] buffer = new byte[1024];
try
{
do
{
listener.Start();
client = listener.AcceptIrDAClient();
byteStream = client.GetStream();
bytesRead = byteStream.Read( buffer, 0, 1024 );
if( byteStream != null )
byteStream.Close();
if( client != null )
client.Close();
AddMessage( client.RemoteMachineName,
Encoding.ASCII.GetString( buffer, 0, bytesRead ));
} while (true);
}
finally
{
if( byteStream != null )
byteStream.Close();
if( client != null )
client.Close();
listener.Stop();
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -