예제 #1
0
 public NetChannel(NetSystem net, NetAddress address, int qport, int maxMessageLength)
 {
     this.net              = net;
     this.Address          = address;
     this.qport            = qport;
     this.maxMessageLength = maxMessageLength;
     this.fragmentBuffer   = new byte[this.maxMessageLength];
     this.unsentBuffer     = new byte[this.maxMessageLength];
 }
예제 #2
0
 internal NetClient(INetHandler netHandler)
 {
     if (netHandler == null)
     {
         throw new JKClientException(new ArgumentNullException(nameof(netHandler)));
     }
     this.net            = new NetSystem();
     this.NetHandler     = netHandler;
     this.packetReceived = new byte[this.NetHandler.MaxMessageLength];
 }
예제 #3
0
 public async Task <IEnumerable <ServerInfo> > GetNewList()
 {
     this.getListTCS?.TrySetCanceled();
     this.getListTCS = new TaskCompletionSource <IEnumerable <ServerInfo> >();
     this.globalServers.Clear();
     foreach (var masterServer in this.masterServers)
     {
         var address = NetSystem.StringToAddress(masterServer.Name, masterServer.Port);
         if (address == null)
         {
             continue;
         }
         this.OutOfBandPrint(address, $"getservers {this.Protocol}");
     }
     this.serverRefreshTimeout = Common.Milliseconds + ServerBrowser.RefreshTimeout;
     return(await this.getListTCS.Task);
 }
예제 #4
0
 public async Task <IEnumerable <ServerInfo> > GetNewList()
 {
     this.serverRefreshTimeout = Common.Milliseconds + ServerBrowser.RefreshTimeout;
     this.getListTCS?.TrySetCanceled();
     this.getListTCS = new TaskCompletionSource <IEnumerable <ServerInfo> >();
     this.globalServers.Clear();
     foreach (var masterServer in this.masterServers)
     {
         var address = NetSystem.StringToAddress(masterServer.Name, masterServer.Port);
         if (address == null)
         {
             continue;
         }
         foreach (ProtocolVersion protocol in Enum.GetValues(typeof(ProtocolVersion)))
         {
             if (protocol == ProtocolVersion.Unknown)
             {
                 continue;
             }
             this.OutOfBandPrint(address, $"getservers {protocol.ToString("d")}");
         }
     }
     return(await this.getListTCS.Task);
 }
예제 #5
0
 public NetChannel(NetSystem net, NetAddress address, int qport)
 {
     this.net     = net;
     this.Address = address;
     this.qport   = qport;
 }
예제 #6
0
 internal NetClient()
 {
     this.net = new NetSystem();
 }
예제 #7
0
 public static NetAddress FromString(string address)
 {
     return(NetSystem.StringToAddress(address));
 }