Esempio n. 1
0
        void receive(object ias)
        {
            while (true)
            {
                try
                {
                    int c     = listconn.Count;
                    int count = (c / Partition) + 1;
                    getbufferdelegate[] iagbd = new getbufferdelegate[count];
                    IAsyncResult[]      ia    = new IAsyncResult[count];

                    if (c > 0)
                    {
                        for (int i = 0; i < count; i++)
                        {
                            c = c - (i * Partition) > Partition ? Partition : c - (i * Partition);
                            NETcollection[] netlist = new NETcollection[c];
                            listconn.CopyTo(i * Partition, netlist, 0, c);

                            iagbd[i] = new getbufferdelegate(getbuffer);
                            ia[i]    = iagbd[i].BeginInvoke(netlist, 0, Partition, null, null);
                        }
                        for (int i = 0; i < count; i++)
                        {
                            iagbd[i].EndInvoke(ia[i]);
                        }
                    }
                    //NETcollection[] netlist = new NETcollection[c];
                    //listconn.CopyTo(0, netlist, 0, c);
                    //getbuffer(netlist, 0, c);
                }
                catch { }
                System.Threading.Thread.Sleep(1);
            }
        }
Esempio n. 2
0
        void receive(object ias)
        {
            while (true)
            {
                try
                {
                    int c     = listconn.Count;
                    int count = (c / Partition) + 1;
                    getbufferdelegate[] iagbd = new getbufferdelegate[count];
                    IAsyncResult[]      ia    = new IAsyncResult[count];

                    if (c > 0)
                    {
                        for (int i = 0; i < count; i++)
                        {
                            c = c - (i * Partition) > Partition ? Partition : c - (i * Partition);
                            NETcollection[] netlist = new NETcollection[c];
                            listconn.CopyTo(i * Partition, netlist, 0, c);

                            iagbd[i] = new getbufferdelegate(getbuffer);
                            ia[i]    = iagbd[i].BeginInvoke(netlist, 0, Partition, 1, 30, null, null);
                        }
                        for (int i = 0; i < count; i++)
                        {
                            iagbd[i].EndInvoke(ia[i]);
                        }
                    }
                    //int c = listconn.Count;
                    //    int count = (c / 2000) + 1;
                    //    if (c > 0)
                    //        for (int i = 0; i < count; i++)
                    //        {

                    //            c = c - (i * 2000) > 2000 ? 2000 : c - (i * 2000);
                    //            NETcollection[] netlist = new NETcollection[c];
                    //            listconn.CopyTo(i * 2000, netlist, 0, c);
                    //            System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback(gg), netlist);
                    //            //new getbufferdelegate(getbuffer).BeginInvoke(netlist, 0, 2000,null,null);
                    //        }
                    //NETcollection[] netlist = new NETcollection[c];
                    //listconn.CopyTo(0, netlist, 0, c);
                    //getbuffer(netlist, 0, c,1,30);
                    System.Threading.Thread.Sleep(1);
                }
                catch (Exception ex)
                { }
            }
        }
Esempio n. 3
0
 void ReceiveHander(object ias)
 {
     while (true)
     {
         try
         {
             int c     = weaveNetworkItems.Count;
             int count = (c / Partition) + 1;
             getbufferdelegate[] iagbd = new getbufferdelegate[count];
             IAsyncResult[]      ia    = new IAsyncResult[count];
             if (c > 0)
             {
                 WeaveNetWorkItems[] netlist = new WeaveNetWorkItems[c];
                 weaveNetworkItems.CopyTo(0, netlist, 0, c);
                 getbuffer(netlist, 0, Partition);
             }
         }
         catch { }
         System.Threading.Thread.Sleep(1);
     }
 }