Exemplo n.º 1
0
        private void partiallySendDictionary(ILHServiceCallback client)
        {
            FileStream fs        = new FileStream(manager.getDictionaryPath(), FileMode.Open, FileAccess.Read);
            int        bytesRead = 0;
            var        bytes     = new byte[16384];

            while ((bytesRead = fs.Read(bytes, 0, 16384)) > 0)
            {
                client.appendDictionaryPart(bytes, 0, bytesRead);
                Console.WriteLine(++count);
            }
            fs.Close();
            fs.Dispose();
        }
Exemplo n.º 2
0
        public void sendNextPackageToClient(ILHServiceCallback call, BigInteger firstIndex)
        {
            lock (SyncObject)
            {
                if (!stopFlag)
                {
                    sentPackages.Remove(firstIndex);

                    bool packageSent = false;

                    double avgTime = processingTime / sentPackageCount;

                    foreach (var item in sentPackages)
                    {
                        if (DateTime.Now.Subtract(item.Value).TotalSeconds > avgTime * 4)
                        {
                            this.getPackage().setFirstIndex(item.Key);
                            sentPackages[item.Key] = DateTime.Now;
                            packageSent            = true;
                            Console.WriteLine("Retransmisja paczki " + item.Key);
                            break;
                        }
                    }

                    if (!packageSent)
                    {
                        this.getPackage().setFirstIndex(actual);
                        sentPackages.Add(actual, DateTime.Now);
                        Console.WriteLine("!packageSent " + actual);
                        actual += this.getPackage().getSizePackage();
                    }
                    //Console.WriteLine("sendNextPackageToClient " + actual);
                    call.getPackageCallback(this.getPackage());
                }
            }
        }
Exemplo n.º 3
0
 public void addClientSerw(ILHServiceCallback GUI)
 {
     this.GUI = GUI;
 }
Exemplo n.º 4
0
 public void addClient(ILHServiceCallback client)
 {
     this.clients.Add(client);
 }