0

如何向服务器发送结构?

我试过了:

import socket
import sys
import capnp
import select
import test_capnp

class Test:
    def __init__(self, serverAddr="127.0.0.1", serverPort = 10000):
        self.serverAddress = (serverAddr, serverPort)
        capnp.remove_import_hook()
        self.setupClient()

    def setupClient(self):
        _socket = socket.socket()
        _socket.connect(self.serverAddress)
        client = capnp.TwoPartyClient(_socket)
        send = client.bootstrap().cast_as(capnp._DynamicCapabilityClient(test_capnp))

测试.capnp:

struct Test {
     id @0 : UInt8;
     msg @1 : Text;
}

此外,我怎样才能给测试赋值?感谢您的帮助:)

4

1 回答 1

-1

大声笑你进入第二轮比赛了吗?

于 2017-11-05T14:01:33.803 回答