RegisterHandlerWithProtocol() public method

public RegisterHandlerWithProtocol ( string type, TransportProtocol protocol, MessageEventHandler handler ) : void
type string
protocol TransportProtocol
handler MessageEventHandler
return void
Ejemplo n.º 1
0
        public void Connect (string address)
        {
            FunapiTcpTransport tcp_transport = new FunapiTcpTransport(address, 8022, FunEncoding.kProtobuf);
            FunapiHttpTransport http_transport = new FunapiHttpTransport(address, 8018, false, FunEncoding.kJson);

            network_ = new FunapiNetwork(true);
            network_.AttachTransport(tcp_transport);
            network_.AttachTransport(http_transport);

            network_.RegisterHandlerWithProtocol("pbuf_echo", TransportProtocol.kTcp, this.OnTcpEcho);
            network_.RegisterHandlerWithProtocol("echo", TransportProtocol.kHttp, this.OnHttpEcho);

            network_.Start();
        }
        public FunapiMulticastClient(FunapiNetwork network, FunEncoding encoding)
        {
            DebugUtils.Assert(network != null);
            network_ = network;
            encoding_ = encoding;

            network_.RegisterHandlerWithProtocol(kMulticastMsgType, TransportProtocol.kTcp, OnReceived);
        }