合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
## client::closesocket ### 接口说明 >关闭客户端连接 > +++ put:closesocket <<< success 无返回值 +++ ### 代码演示 ~~~ #import "socket" var socket_connected() { println("连接成功啦"); var writer = new Buffer(); writer.writeString("这是一个乒乓消息"); client.send(writer); } var socket_data(var buffer) { var s = buffer.tostring(); println(s); Sleep(5000); var writer = new Buffer(); writer.writeString(buffer.tostring()); client.send(writer); } var socket_close(var err,var errstr) { println("检测到有一个关闭:err:{err},errstr:{errstr}"); } var client = new socket::client(); client.setoption(new ClientOption(){ connected = socket_connected, data = socket_data, close = socket_close }); var b = client.connect("192.168.1.166",4060); while (true) { client.run(); } ~~~