Socket.D v2.5.11

应用 - 配置接口

</> markdown

可以通过 config 函数里的配置类,了解更多的可选配置。

1、客户端

public class Demo 
    public static void main(String[] args) throws Throwable {
        //::打开客户端会话
        SocketD.createClient("sd:ws://127.0.0.1:8602/?u=a&p=2")
                .config(c->c.fragmentSize(1024*1024))
                .open();
    }
}

2、服务端

public class Demo {
    public static void main(String[] args) throws Throwable {
        //::启动服务端
        SocketD.createServer("sd:ws")
                .config(c -> c.port(8602).fragmentSize(1024*1024).sslContext(null))
                .start();
    }
}