LUA 脚本 - 网络套接字通信 [英] LUA Script - web socket communication

查看:43
本文介绍了LUA 脚本 - 网络套接字通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于 Linux 的机器和 android 应用程序之间工作.

I am working with between Linux-based machine and android app.

首先,我需要在机器上打开一个服务器套接字来与应用程序通信.

First of all, I need to open a server socket on the machine to communicate with the app.

我需要用 LUA 脚本编写代码,但我不知道它..

I need to code with LUA Script, and I have no idea with it..

你能给我一些例子来打开一个服务器套接字并接收来自android应用程序的消息吗?

Could you please give me some exmaple to open a server socket and receive the message from android app?

谢谢.

推荐答案

如果您正在寻找 Lua 中的 websocket 支持,请尝试 lua-websockets.

If you are looking for websocket support in Lua, try lua-websockets.

对于普通的socket,可以使用luasocket;介绍 页面包含一个通过 TCP 工作的回显服务器示例;这个 SO answer 包括一个客户端示例.

For regular sockets, you can use luasocket; the introduction page includes an echo server example working over TCP; this SO answer includes a client example.

这篇关于LUA 脚本 - 网络套接字通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆