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 void Connect(string hostname_or_ip, ushort port, bool session_reliability) { bool need_to_start = false; Debug.Log(String.Format("Multicast server is at {0}:{1}", hostname_or_ip, port)); lock (lock_) { transport_ = new FunapiTcpTransport (hostname_or_ip, port, encoding_); DebugUtils.Assert (transport_ != null); network_ = new FunapiNetwork (session_reliability); network_.AttachTransport (transport_); network_.RegisterHandler(kMulticastMsgType, OnReceived); need_to_start = true; } if (need_to_start) { network_.Start (); } }