SDL2_net 脚本
SDL2_net emscripten
我尝试在用 C++ 编写的跨平台项目中使用 https://github.com/emscripten-ports/SDL2_net,但是当我尝试通过 SDLNet_TCP_Open() 打开 TCP 套接字时,函数 return 错误 "Couldn't connect to remote host" 但是服务器没问题,桌面和移动客户端都可以正常工作。
首先,我在浏览器中使用 url C:/[PATH TO generated.html]/ 测试由 emscripten 生成的 .js 和 .html,但我认为在本地我没有权限((因为它在 android 中,我有同样的错误,然后我在...工作后在清单请求中写了权限))但是当我将我的客户端上传到 http-server 时,错误仍然存在。
有人知道吗?
编辑。
我尝试 -s USE_SDL_NET=2
Note
SDL_net has also been added to ports, use it with -s USE_SDL_NET=2. To
see a list of all available ports, run emcc --show-ports.
来自 https://kripken.github.io/emscripten-site/docs/compiling/Building-Projects.html
但我收到错误:
WARNING:root:Assigning a non-existent settings attribute "USE_SDL_NET"
WARNING:root: - did you mean one of USE_SDL_TTF, USE_SDL, USE_SDL_IMAGE?
WARNING:root: - perhaps a typo in emcc's -s X=Y notation?
WARNING:root: - (see src/settings.js for valid values)
emcc --show-ports, return:
Available ports:
zlib (USE_ZLIB=1; zlib license)
libpng (USE_LIBPNG=1; zlib license)
SDL2 (USE_SDL=2; zlib license)
SDL2_image (USE_SDL_IMAGE=2; zlib license)
ogg (USE_OGG=1; zlib license)
vorbis (USE_VORBIS=1; zlib license)
bullet (USE_BULLET=1; zlib license)
freetype (USE_FREETYPE=1; freetype license)
SDL2_ttf (USE_SDL_TTF=2; zlib license)
EDIT2.
我从https://github.com/jbaicoianu/emscripten/tree/c46b429ede3f5e015fe3e460867e225c3e45ae95
下载
embuilder.py, sdl-net.py, __init__py 然后注入我的 emscripten,构建过程成功,没有上面提到的问题。
但主要问题仍然存在...我有 "Couldn't connect to remote host" 错误。
干杯,
卢克
浏览器无法启动普通的旧 TCP。它使用 websockets,这基本上只是一次握手。当一切顺利时,他们将连接升级到普通的旧 TCP。
使用我们这样的 tcp -> websocket 网关 websockify
编辑:我对普通老式 tcp 的看法是错误的,websocket 是基于 TCP 的不同协议,但 websockify 可以转换。
我尝试在用 C++ 编写的跨平台项目中使用 https://github.com/emscripten-ports/SDL2_net,但是当我尝试通过 SDLNet_TCP_Open() 打开 TCP 套接字时,函数 return 错误 "Couldn't connect to remote host" 但是服务器没问题,桌面和移动客户端都可以正常工作。
首先,我在浏览器中使用 url C:/[PATH TO generated.html]/ 测试由 emscripten 生成的 .js 和 .html,但我认为在本地我没有权限((因为它在 android 中,我有同样的错误,然后我在...工作后在清单请求中写了权限))但是当我将我的客户端上传到 http-server 时,错误仍然存在。
有人知道吗?
编辑。 我尝试 -s USE_SDL_NET=2
Note
SDL_net has also been added to ports, use it with -s USE_SDL_NET=2. To see a list of all available ports, run emcc --show-ports.
来自 https://kripken.github.io/emscripten-site/docs/compiling/Building-Projects.html
但我收到错误:
WARNING:root:Assigning a non-existent settings attribute "USE_SDL_NET"
WARNING:root: - did you mean one of USE_SDL_TTF, USE_SDL, USE_SDL_IMAGE?
WARNING:root: - perhaps a typo in emcc's -s X=Y notation?
WARNING:root: - (see src/settings.js for valid values)
emcc --show-ports, return:
Available ports:
zlib (USE_ZLIB=1; zlib license)
libpng (USE_LIBPNG=1; zlib license)
SDL2 (USE_SDL=2; zlib license)
SDL2_image (USE_SDL_IMAGE=2; zlib license)
ogg (USE_OGG=1; zlib license)
vorbis (USE_VORBIS=1; zlib license)
bullet (USE_BULLET=1; zlib license)
freetype (USE_FREETYPE=1; freetype license)
SDL2_ttf (USE_SDL_TTF=2; zlib license)
EDIT2.
我从https://github.com/jbaicoianu/emscripten/tree/c46b429ede3f5e015fe3e460867e225c3e45ae95
下载embuilder.py, sdl-net.py, __init__py 然后注入我的 emscripten,构建过程成功,没有上面提到的问题。 但主要问题仍然存在...我有 "Couldn't connect to remote host" 错误。
干杯, 卢克
浏览器无法启动普通的旧 TCP。它使用 websockets,这基本上只是一次握手。当一切顺利时,他们将连接升级到普通的旧 TCP。
使用我们这样的 tcp -> websocket 网关 websockify
编辑:我对普通老式 tcp 的看法是错误的,websocket 是基于 TCP 的不同协议,但 websockify 可以转换。