企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## client::isconnect ### 接口说明 >客户端连接状态 > +++ put:isconnect <<< 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(); } ~~~