Websocket服务器响应包,服务器websocket c++发送二进制类型包,客户端没有任何事件响应...

服务器端        std::string body_str1 = "12345";

std::string outMsg;

wsEncodeFrame(body_str1, outMsg, WS_TEXT_FRAME);//就是加上个2字节头

int32_t send_size = m_socket->send(asio::buffer(outMsg));//客户端能收到

std::string body_str;

pbMsg.SerializeToString(&body_str);//protoBuf消息转二进制流

std::string outMsg2;

wsEncodeFrame(body_str, outMsg2, WS_BINARY_FRAME);

send_size = m_socket->send(asio::buffer(outMsg2));//客户端无任何响应,error也没

客户端:

socket = new Socket();

//socket.connect("echo.websocket.org", 80);

//socket.connectByUrl("ws://echo.websocket.org:80");

socket.connectByUrl('ws://127.0.0.1:88');//

//output.endian = Byte.LITTLE_ENDIAN;//这里我们采用小端;

output = socket.output;

//socket.endian = Byte.LITTLE_ENDIAN;//这里我们采用小端;

socket.on(Laya.Event.OPEN, this, onSocketOpen);

socket.on(Laya.Event.CLOSE, this, onSocketClose);

socket.on(Laya.Event.MESSAGE, this, onMessageReveived);

socket.on(Laya.Event.ERROR, this, onConnectError);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值