Esempio n. 1
0
 public static Offset <ClientProperty> CreateClientProperty(FlatBufferBuilder builder,
                                                            StringOffset nodeNameOffset = default(StringOffset),
                                                            StringOffset myIpOffset     = default(StringOffset),
                                                            bool isPublisher            = false,
                                                            int topicPort = 0,
                                                            StringOffset targetNodeNameOffset = default(StringOffset),
                                                            StringOffset targetIPOffset       = default(StringOffset),
                                                            int targetPort = 0)
 {
     builder.StartObject(7);
     ClientProperty.AddTargetPort(builder, targetPort);
     ClientProperty.AddTargetIP(builder, targetIPOffset);
     ClientProperty.AddTargetNodeName(builder, targetNodeNameOffset);
     ClientProperty.AddTopicPort(builder, topicPort);
     ClientProperty.AddMyIp(builder, myIpOffset);
     ClientProperty.AddNodeName(builder, nodeNameOffset);
     ClientProperty.AddIsPublisher(builder, isPublisher);
     return(ClientProperty.EndClientProperty(builder));
 }
Esempio n. 2
0
    /// <summary>
    /// Send this client information to the server
    /// </summary>
    public void sendMyInfo()
    {
        FlatBufferBuilder fbb                = new FlatBufferBuilder(1);
        StringOffset      fbb_name           = fbb.CreateString(clientName);
        StringOffset      fbb_myIp           = fbb.CreateString("127.0.0.1");
        StringOffset      fbb_targetIP       = fbb.CreateString(this.targetIP);
        StringOffset      fbb_targetNodeName = fbb.CreateString(targetNodeName);

        Debug.Log("packing clinet name: " + clientName);
        ClientProperty.StartClientProperty(fbb);
        ClientProperty.AddNodeName(fbb, fbb_name);
        ClientProperty.AddIsPublisher(fbb, isPublisher);
        ClientProperty.AddMyIp(fbb, fbb_myIp);
        ClientProperty.AddTopicPort(fbb, topicPort);
        ClientProperty.AddTargetIP(fbb, fbb_targetIP);
        ClientProperty.AddTargetNodeName(fbb, fbb_targetNodeName);
        ClientProperty.AddTargetPort(fbb, targetPort);
        var offset = ClientProperty.EndClientProperty(fbb);

        ClientProperty.FinishClientPropertyBuffer(fbb, offset);
        byte[] bMsg = fbb.SizedByteArray();
        send(bMsg);
    }