日期:2014-05-16 浏览次数:20917 次
public partial class Client : Form
{
Socket vsClientSocket;
Thread vsClientThread;
string strIP = "127.0.0.1";
public delegate void PassString(string strMsg);
int nPort = 9002;
public Client()
{
InitializeComponent();
}
public void SetSendData(string strMsg)
{
if (tBoxClientSend.InvokeRequired == true)
{
PassString d = new PassString(SetSendData);
this.Invoke(d, new object[] { strMsg });
}
else
{
tBoxClientSend.Text = strMsg;
}
}
public void SetRecvData(string strMsg)
{
if (tBoxClientReceive.InvokeRequired == true)
{
PassString d = new PassString(SetRecvData);
this.Invoke(d, new object[] { strMsg });
}
else
{
tBoxClientReceive.Text = strMsg;
}
}
privat