Dotcloud www和TCP在单个应用程序中- [英] Dotcloud www and TCP in single app -

查看:104
本文介绍了Dotcloud www和TCP在单个应用程序中-的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行一个nodejs套接字服务器,该服务器将允许运行Flash游戏的两个客户端之间进行远程通信,这些Flash游戏使用自定义协议进行通信.由于Flash安全性的限制,套接字服务器似乎必须与托管Flash游戏的Web服务器在同一主机上运行.我一直不断遇到以下错误:

I'm trying to get a nodejs socket server running that will allow remote communication between two clients running a Flash game that communicates using a custom protocol. Due to Flash security restrictions, it seems that the socket server must be running on the same host as the web server that servers the Flash game. I've been continuously getting the following error:

The service crashed at startup or is listening to the wrong port. It failed to respond on port "nodejs" (8080) within 30 seconds

我需要的是一种在运行NodeJS服务器代码的同时提供Flash文件的方法.

What I need is a way to run my nodeJS server code, while simultaneously serve the flash files.

我正在使用环境JSON变量来确定要侦听的端口,而我的YML与所讨论的

I'm using the environment JSON variables to determine what port to listen on, and my YML is similar to the one discussed here but no luck... Just wondering if I can get some info on how to create a working socket server/web server that will work for this (or if it is actually possible)

推荐答案

您可以使用以下dotcloud.yml文件:

www:
  type: nodejs
  ports:
    mything: tcp

然后在Node.js应用程序中,可以将HTTP服务器绑定到端口8080,并将任意TCP服务器绑定到环境变量$PORT_MYTHING包含的端口.然后在您的服务上运行dotcloud info;在ports部分,您将看到类似以下内容的内容:

Then in your Node.js app, you can bind a HTTP server to port 8080, and an arbitrary TCP server to the port contained by environment variable $PORT_MYTHING. Then run dotcloud info on your service; in the ports section, you will see something like this:

-   name: mything
    url: tcp://myapp-johndoe.dotcloud.com:12345

从现在开始,如果您在端口12345上连接到myapp-johndoe.dotcloud.com,则实际上将连接到应用程序中的$PORT_MYTHING.

From now on, if you connect to myapp-johndoe.dotcloud.com on port 12345, you will actually connect to $PORT_MYTHING in your application.

我希望这是有道理的,而且这就是您想要的!

I hope that it makes sense, and that it is what you were looking for!

这篇关于Dotcloud www和TCP在单个应用程序中-的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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