douhang8991
2015-12-16 15:40
浏览 29
已采纳

如何使用Go运行时在App Engine上的实例之间传递套接字?

The Python runtime allows it by pickling the connection. Is there a similar way to share sockets using the Go runtime on classic App Engine with google.golang.org/appengine/socket?

图片转代码服务由CSDN问答提供 功能建议

Python运行时允许挑选连接 是否可以使用类似的方法在经典App Engine上使用Go运行时与 google.golang.org/appengine/socket 共享套接字?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doumen5895 2015-12-17 02:27
    已采纳

    The descriptor isn't exposed in the Go API: https://github.com/golang/appengine/blob/master/socket/socket_classic.go#L152

    type Conn struct {
        ctx    context.Context
        desc   string
        offset int64
    
        prot          pb.CreateSocketRequest_SocketProtocol
        local, remote *pb.AddressPort
    
        readDeadline, writeDeadline time.Time // optional
    }
    

    desc is what you would need on the other side to reconstruct the socket.

    It should be possible fork this library on GitHub, change the conn struct to expose the needed desc property, and then change the import to github.com/YOURUSERNAME/appengine/socket instead of appengine/socket.

    It's a lot of work so if you can come up with a different way to solve this you're probably better off. Nevertheless it should be possible.

    点赞 评论

相关推荐 更多相似问题