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?

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试