易语言websocket客户端纯源码(无模块)
<p><img src="https://mangsafe.oss-cn-beijing.aliyuncs.com/20190829191937100.gif"></p><p> </p>
<p> </p>
<p><img src="https://pcbugdl.oss-cn-beijing.aliyuncs.com/png/QQ%E6%88%AA%E5%9B%BE20190519165740.jpg"></p>
<p>下载地址:https://6yunpan.pipipan.com/fs/17009107-375104141</p>
<p>以下是部分代码,完整代码请自行去下载</p>
<div class="cnblogs_code">
<pre>.版本 <span style="color: rgba(128, 0, 128, 1)">2</span><span style="color: rgba(0, 0, 0, 1)">
.程序集 Main
.子程序 _启动子程序, 整数型, , 请在本子程序中放置易模块初始化代码
.局部变量 WSAData, WSADATA
</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> 本源码来自易语言资源网</span><span style="color: rgba(128, 0, 0, 1)">
'</span><span style="color: rgba(128, 0, 0, 1)"> (www.eyuyan.la)</span>
.如果真 (WSAStartup (<span style="color: rgba(128, 0, 128, 1)">514</span>, WSAData) ≠ <span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">)
输出调试文本 (“WSA 初始化失败”)
返回 (</span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">)
.如果真结束
</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> 改自此帖开源感谢原作者开源 https://bbs.125.la/forum.php?mod=viewthread&tid=14039123&highlight=websocket</span><span style="color: rgba(128, 0, 0, 1)">
'</span><span style="color: rgba(128, 0, 0, 1)"> 有问题私信论坛</span>
<span style="color: rgba(0, 0, 0, 1)">
测试程序 ()
返回 (</span><span style="color: rgba(128, 0, 128, 1)">0</span>)<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> 可以根据您的需要返回任意数值</span>
<span style="color: rgba(0, 0, 0, 1)">
.子程序 测试程序
.局部变量 封包, 字节集, , </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">0</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">
.局部变量 ws, WebSocket
.局部变量 i, 整数型
.如果真 (ws.连接 (“ws:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">127.0.0.1:8080/”))</span>
ws.发送 (到字节集 (“I<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">m coming”))</span>
<span style="color: rgba(0, 0, 0, 1)"> .计次循环首 (ws.接收 (封包), i)
.如果真 (封包 = 到字节集 (“心跳”))
ws.发送 (到字节集 (</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">好巧 我的心也在跳</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">)
.如果真结束
.如果真 (封包 = 到字节集 (“停止心跳”))
跳出循环 ()
.如果真结束
Sleep (</span><span style="color: rgba(128, 0, 128, 1)">100</span><span style="color: rgba(0, 0, 0, 1)">)
.计次循环尾 ()
ws.断开 ()</span></pre>
</div>
<p> </p><br><br>
来源:https://www.cnblogs.com/xiazai/p/10889848.html
頁:
[1]