public async Task <ServerStatus> RequestStatus() { var client = new TcpClient(); var task = client.ConnectAsync(ip, port); while (!task.IsCompleted) { Debug.WriteLine("Connecting.."); await Task.Delay(250); } if (!client.Connected) { return(ServerStatus.Empty); } var stream = client.GetStream(); var handshake = new HandshakePacket() { Address = ip, Port = port, LoginState = LoginStates.Status, ProtocolVersion = Program.CurrentProto }; var statusRequest = new Request(); stream.Write(handshake.Stream()); stream.Write(statusRequest.Stream()); var buffer = new byte[Int16.MaxValue]; stream.Read(buffer, 0, buffer.Length); var status = new ResponsePacket(); try { McVarint.TryParse(ref buffer, out int length); McVarint.TryParse(ref buffer, out int packetId); status.Read(buffer); } catch { } return(status.GetStatus()); }