日期:2014-05-17 浏览次数:20827 次
CClient MyClient = new Client.CClient();
private void button1_Click(object sender, EventArgs e)
{
MyClient.StartThread();
}
public void BeginSend()
{
IPEndPoint iep = new IPEndPoint("127.0.0.1", 8070);
byte[] byteMessage =new byte[1024];
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(iep);
byteMessage = Encoding.Default.GetBytes("消息");
socket.Send(byteMessage);
}