high performance dotnet core socket tcp communication components, support TCP, SSL, HTTP, HTTPS, WebSocket, RPC, Redis protocols ... and 1M connections problem solution
-
High performance lightweight http and websocket server components
-
High performance remote interface invoke(RPC) communication components
BeetleX's tcp, http, websocket, xprc ... Samples
class Program : ServerHandlerBase
{
private static IServer server;
public static void Main(string[] args)
{
server = SocketFactory.CreateTcpServer<Program>();
//server.Options.DefaultListen.CertificateFile = "text.pfx";
//server.Options.DefaultListen.SSL = true;
//server.Options.DefaultListen.CertificatePassword = "123456";
server.Open();
Console.Write(server);
Console.Read();
}
public override void SessionReceive(IServer server, SessionReceiveEventArgs e)
{
var pipeStream = e.Stream.ToPipeStream();
string name = pipeStream.ReadLine();
Console.WriteLine(name);
pipeStream.WriteLine("hello " + name);
e.Session.Stream.Flush();
base.SessionReceive(server, e);
}
}
TcpClient client = SocketFactory.CreateClient<TcpClient>("127.0.0.1", 9090);
//ssl
//TcpClient client = SocketFactory.CreateSslClient<TcpClient>("127.0.0.1", 9090, "localhost");
while (true)
{
Console.Write("Enter Name:");
var line = Console.ReadLine();
client.Stream.ToPipeStream().WriteLine(line);
client.Stream.Flush();
var reader = client.Read();
line = reader.ToPipeStream().ReadLine();
Console.WriteLine(line);
}
AsyncTcpClient client = SocketFactory.CreateClient<AsyncTcpClient>("127.0.0.1", 9090);
//SSL
//AsyncTcpClient client = SocketFactory.CreateSslClient<AsyncTcpClient>("127.0.0.1", 9090, "serviceName");
Client.AutoReceive = false;
while (true)
{
var line = Console.ReadLine();
var result = await Client.ReceiveFrom(s => s.WriteLine(line));
//or
//Client.Send(s => s.WriteLine(line));
//result = await Client.Receive();
Console.WriteLine(result.ReadLine());
}
https://tfb-status.techempower.com/
Server:E3-1230V2 Bandwidth:10Gb