Search in sources :

Example 1 with EzyMainEventsLoop

use of com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop in project ezyfox-server-example by tvd12.

the class TcpSocketStresstest method main.

public static void main(String[] args) throws Exception {
    DefaultClientConfig clientConfig = new DefaultClientConfig();
    SocketClientSetup setup = new SocketClientSetup("websocket");
    EzyClients clients = EzyClients.getInstance();
    new Thread(() -> {
        int clientCount = 300;
        for (int i = 0; i < clientCount; i++) {
            EzyTcpClient client = new EzyTcpClient(clientConfig.get(i));
            try {
                Thread.sleep(50);
            } catch (Exception e) {
                e.printStackTrace();
            }
            setup.setup(client, false);
            clients.addClient(client);
            client.connect("127.0.0.1", 3005);
        }
    }).start();
    EzyMainEventsLoop mainEventsLoop = new EzyMainEventsLoop();
    mainEventsLoop.start(5);
}
Also used : EzyTcpClient(com.tvd12.ezyfoxserver.client.EzyTcpClient) EzyClients(com.tvd12.ezyfoxserver.client.EzyClients) EzyMainEventsLoop(com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop)

Example 2 with EzyMainEventsLoop

use of com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop in project ezyfox-server-example by tvd12.

the class UdpSocketStresstest method main.

public static void main(String[] args) throws Exception {
    DefaultClientConfig clientConfig = new DefaultClientConfig();
    SocketClientSetup setup = new SocketClientSetup("websocket");
    EzyClients clients = EzyClients.getInstance();
    new Thread(() -> {
        int clientCount = 500;
        for (int i = 0; i < clientCount; i++) {
            EzyTcpClient client = new EzyUTClient(clientConfig.get(i));
            try {
                Thread.sleep(50);
            } catch (Exception e) {
                e.printStackTrace();
            }
            setup.setup(client, true);
            clients.addClient(client);
            client.connect("127.0.0.1", 3005);
        }
    }).start();
    EzyMainEventsLoop mainEventsLoop = new EzyMainEventsLoop();
    mainEventsLoop.start(5);
}
Also used : EzyTcpClient(com.tvd12.ezyfoxserver.client.EzyTcpClient) EzyUTClient(com.tvd12.ezyfoxserver.client.EzyUTClient) EzyClients(com.tvd12.ezyfoxserver.client.EzyClients) EzyMainEventsLoop(com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop)

Example 3 with EzyMainEventsLoop

use of com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop in project ezyfox-server-example by tvd12.

the class HelloWorldClient method main.

public static void main(String[] args) throws Exception {
    String host = "127.0.0.1";
    int port = 3005;
    if (args.length > 0) {
        host = args[0];
    }
    if (args.length > 1) {
        port = Integer.parseInt(args[1]);
    }
    HelloWorldClient client = new HelloWorldClient();
    client.connect(host, port);
    EzyMainEventsLoop mainEventsLoop = new EzyMainEventsLoop();
    mainEventsLoop.start();
}
Also used : EzyMainEventsLoop(com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop)

Example 4 with EzyMainEventsLoop

use of com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop in project ezyfox-server-example by tvd12.

the class HelloWorldClientUdp method main.

public static void main(String[] args) throws Exception {
    String host = "127.0.0.1";
    int port = 3005;
    if (args.length > 0) {
        host = args[0];
    }
    if (args.length > 1) {
        port = Integer.parseInt(args[1]);
    }
    HelloWorldClientUdp client = new HelloWorldClientUdp();
    client.connect(host, port);
    EzyMainEventsLoop mainEventsLoop = new EzyMainEventsLoop();
    mainEventsLoop.start();
}
Also used : EzyMainEventsLoop(com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop)

Example 5 with EzyMainEventsLoop

use of com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop in project ezyfox-server-example by tvd12.

the class WebSocketStresstest method main.

public static void main(String[] args) throws Exception {
    DefaultClientConfig clientConfig = new DefaultClientConfig();
    SocketClientSetup setup = new SocketClientSetup("websocket");
    EzyClients clients = EzyClients.getInstance();
    new Thread(() -> {
        int clientCount = 300;
        for (int i = 0; i < clientCount; i++) {
            EzyWsClient client = new EzyWsClient(clientConfig.get(i));
            try {
                Thread.sleep(50);
            } catch (Exception e) {
                e.printStackTrace();
            }
            setup.setup(client, false);
            clients.addClient(client);
            client.connect("ws://127.0.0.1:2208/ws");
        }
    }).start();
    EzyMainEventsLoop mainEventsLoop = new EzyMainEventsLoop();
    mainEventsLoop.start(5);
}
Also used : EzyWsClient(com.tvd12.ezyfoxserver.client.EzyWsClient) EzyClients(com.tvd12.ezyfoxserver.client.EzyClients) EzyMainEventsLoop(com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop)

Aggregations

EzyMainEventsLoop (com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop)6 EzyClients (com.tvd12.ezyfoxserver.client.EzyClients)3 EzyTcpClient (com.tvd12.ezyfoxserver.client.EzyTcpClient)2 EzyUTClient (com.tvd12.ezyfoxserver.client.EzyUTClient)1 EzyWsClient (com.tvd12.ezyfoxserver.client.EzyWsClient)1