protected TcpHostServer SetupTcpServer() { tcpServer = TcpHostServer.Create(this.LocalAddress); tcpServer.OnConnect += OnTcpConnect; tcpServer.OnReceive += OnTcpServerReceive; tcpServer.OnClose += OnTcpServerClose; tcpServer.OnException += OnTcpServerException; Log.Info(string.Format("TCP-Server@{0}", this.LocalAddress.ToIPv4String())); return(tcpServer); }
protected TcpHostServer CreateTcpServer(IPEndPoint extAddr, IPEndPoint localAddr) { var tcpServer = TcpHostServer.Create(localAddr); tcpServer.OnConnect += OnTcpConnect; tcpServer.OnReceive += OnTcpServerReceive; tcpServer.OnClose += OnTcpServerClose; tcpServer.OnException += OnTcpServerException; Log.Info(string.Format("TCP-Server@{0}", localAddr.ToIPv4String())); return(tcpServer); }
public static TcpHostServer Create(IPEndPoint ep) { var channelConfig = new TcpChannelConfig(); channelConfig.Address = ep;// ip;// "0.0.0.0"; //channelConfig.Port = port; #if !UNITY_5_3_OR_NEWER channelConfig.UseLibuv = true; #endif var obj = new TcpHostServer(); if (!obj.Init(channelConfig, ep)) { return(null); } return(obj); }
//public static TcpHostServer Create(IPEndPoint ep) //{ // return Create(ep.Address.ToIPv4String(), ep.Port); //} public static TcpHostServer Create(IPEndPoint ep) { var channelConfig = new TcpChannelConfig(); channelConfig.Address = ep;// ip;// "0.0.0.0"; //channelConfig.Port = port; #if !UNITY_5_3_OR_NEWER channelConfig.UseLibuv = true; #endif var listener = new TcpHostServer(); var server = new TcpSocketServer(); if (!server.Start(channelConfig, listener)) { return(null); } return(listener); }