110,552
社区成员
发帖
与我相关
我的任务
分享
var client = new ConnectionClient.AsyncBinarySocketClient(8192, 8192, 3000, 3000);
client.RegisterServerNode("1122", new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 8888));
byte[] bytes = null;
string str = "njyang110"+"\t"+"123456";
bytes = Encoding.Unicode.GetBytes(ConnectionBase.SerializeHelper.StringToBinaryString(str));
for (int i = 0; i < 12; i++)
{
client.Send("Login", bytes, res => BitConverter.ToInt32(res.Buffer, 0)).ContinueWith(c =>
{
if (c.IsFaulted)
{
Console.WriteLine(c.Exception.ToString());
return;
}
});
System.Threading.Thread.Sleep(50);
}
client.UnRegisterServerNode("1122");
client.Stop();
Console.ReadLine();
for (int i = 0; i < 1200; i++)
{
var client = new ConnectionClient.AsyncBinarySocketClient(8192, 8192, 3000, 3000);
client.RegisterServerNode("主服务器", new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 8401));
byte[] bytes = null;
string str = "njyang110"+"\t"+"123456";
bytes = Encoding.Unicode.GetBytes(ConnectionBase.SerializeHelper.StringToBinaryString(str));
client.Send("Login", bytes, res => BitConverter.ToInt32(res.Buffer, 0)).ContinueWith(c =>
{
if (c.IsFaulted)
{
Console.WriteLine(c.Exception.ToString());
return;
}
});
System.Threading.Thread.Sleep(50);
client.UnRegisterServerNode("主服务器");
client.Stop();
}
Console.ReadLine();
var client = new ConnectionClient.AsyncBinarySocketClient(8192, 8192, 3000, 3000);
for (int i = 0; i < 3; i++)
{
client.RegisterServerNode("主服务器", new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 8401));
byte[] bytes = null;
string str = "njyang110"+"\t"+"123456";
bytes = Encoding.Unicode.GetBytes(ConnectionBase.SerializeHelper.StringToBinaryString(str));
client.Send("Login", bytes, res => BitConverter.ToInt32(res.Buffer, 0)).ContinueWith(c =>
{
if (c.IsFaulted)
{
Console.WriteLine(c.Exception.ToString());
return;
}
});
System.Threading.Thread.Sleep(50);
client.UnRegisterServerNode("主服务器");
client.Stop();
}
for (int i = 0; i < 1200; i++)
{
var client = new ConnectionClient.AsyncBinarySocketClient(8192, 8192, 3000, 3000);
client.RegisterServerNode("主服务器", new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 8401));
byte[] bytes = null;
string str = "njyang110"+"\t"+"123456";
bytes = Encoding.Unicode.GetBytes(ConnectionBase.SerializeHelper.StringToBinaryString(str));
client.Send("Login", bytes, res => BitConverter.ToInt32(res.Buffer, 0)).ContinueWith(c =>
{
if (c.IsFaulted)
{
Console.WriteLine(c.Exception.ToString());
return;
}
});
System.Threading.Thread.Sleep(50);
client.UnRegisterServerNode("主服务器");
client.Stop();
}
Console.ReadLine();