如何在Google App Engine上使用Golang构建TCP监听器或服务器?

huangapple go评论91阅读模式
英文:

How to build an TCP listener or server on google appengine maybe in golang?

问题

我想在Google App-Engine上构建一个TCP接收器/监听器/服务器。例如,接收特定端口上的TCP消息,类似于syslog服务器,并处理请求。使用Go语言编写的代码将是理想的,但实际上任何appengine支持的语言都可以。

有人知道我是否可以设置appengine来处理TCP请求吗?

英文:

I'd like to build an TCP receiver/listener/server to run on Google App-Engine. For example to receive messages over TCP on a specific port, similar to a syslog server, and process the request. Something in Go language would be ideal, but really anything appengine supports.

Does anyone know if and how I can setup appengine to proccess TCP requests?

答案1

得分: 4

AppEngine在一个受限环境中运行您的应用程序,您可能无法打开套接字,正如他们的什么是Google App Engine?指南中所提到的:

> 与Java和Python环境一样,沙箱中并不提供标准库的所有功能。例如,尝试打开套接字或写入文件将返回os.EINVAL错误。

英文:

AppEngine runs your applications in a sandboxed environment and you may not open sockets, as mentioned in their What Is Google App Engine? guide:

> As with the Java and Python environments, not all the standard
> library's functionality is available inside the sandbox. For example,
> attempts to open a socket or write to a file will return an os.EINVAL
> error.

答案2

得分: 2

App Engine的设计用于处理HTTP请求,这些请求是TCP请求。如果您选择使用App Engine,您应该设计您的服务器来处理HTTP请求。

如果您需要在更低的级别上运行,您可能最好使用像亚马逊这样的工具,它们具有弹性IP等工具,这将使这个过程更容易。

英文:

App Engine's designed to handle HTTP requests, which are TCP requests. If you choose to use App Engine, you should probably design your server to handle HTTP requests.

If you need to run on a lower level, you're probably better off using something like Amazon which has tools like their elastic IPs that would make this much easier.

huangapple
  • 本文由 发表于 2012年6月1日 08:15:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/10842915.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定