Ejemplo n.º 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];
 }
Ejemplo n.º 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];
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 5
0
 public NetChannel(NetSystem net, NetAddress address, int qport)
 {
     this.net     = net;
     this.Address = address;
     this.qport   = qport;
 }
Ejemplo n.º 6
0
 internal NetClient()
 {
     this.net = new NetSystem();
 }
Ejemplo n.º 7
0
 public static NetAddress FromString(string address)
 {
     return(NetSystem.StringToAddress(address));
 }