你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
cuixueying
赞同来自: Zzz18815519
Zzz18815519
赞同来自:
要回复问题请先登录
2 个回复
cuixueying
赞同来自: Zzz18815519
Zzz18815519
赞同来自:
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);