public delegate void ReceiveDataWrite(int port, bool state);
public void WriteData(int port, bool msg)
{
ReceiveDataWrite deleWrite = new ReceiveDataWrite(WriteReceiveData);
this.Invoke(deleWrite, new object[] { port,msg });
}
public void WriteReceiveData(int port, bool msg)
{
RecvtextBox.AppendText(port.ToString() + " " + msg.ToString() + "\r\n");
}
private void ClientReceive(string ip, int port )
{
try
{
cpTcpClient = new TcpClient(ip, port);
if (true == cpTcpClient.Connected)
{
WriteData(port ,true);
}
}
catch (Exception)
{
WriteData(port ,false);
}
finally
{
if (null != cpTcpClient)
cpTcpClient.Close();
}
return;
}
URL spy (0) | 2012.01.27 |
---|---|
IE 실행 시키기 (0) | 2012.01.27 |
IP Address Calculations with C# (Subnetmasks, Networks, …) (0) | 2011.12.26 |
TreeNode 찾기 (0) | 2011.12.14 |
c# InputBox (0) | 2011.12.14 |