Example #1
0
 private void Server_EventUpdataConnSoc(Socket soc)
 {
     ModeA m = new ModeA();
     m.Tongdao = cameraData.Code;
     m.Soc = soc;
     listA.Add(m);
 }
Example #2
0
 private void Server_EventDeleteConnSoc(Socket soc)
 {
     try
     {
         int count = listA.Count;
         ModeA[] ma = new ModeA[listA.Count];
         listA.CopyTo(0, ma, 0, count);
         foreach (ModeA m in ma)
         {
             if (m != null)
                 if (m.Soc == soc)
                     listA.Remove(m);
         }
     }
     catch { }
 }
Example #3
0
        public static void RealDataCallBack(int lRealHandle, UInt32 dwDataType, IntPtr pBuffer, UInt32 dwBufSize, IntPtr dwUser)
        {
            if (dwDataType == 1)
            { }
            else
            { return; }
            try
            {
                byte[] pBufferdata = new byte[dwBufSize];
                int i = 0;
                while (i < pBufferdata.Length)
                {
                    pBufferdata[i] = Marshal.ReadByte(pBuffer, i);
                    i++;
                }
                if (dwUser.ToString() == "1314")
                {
                }
                else { }
                try
                {
                    int count = listA.Count;
                    ModeA[] ma = new ModeA[listA.Count];
                    listA.CopyTo(0, ma, 0, count);
                    foreach (ModeA m in ma)
                    {
                        if (m != null)
                        
                        if (m.Tongdao == dwUser.ToString())
                            {
                             
                                try
                                {
                                    m.Soc.Send(pBufferdata);
                                }
                                catch { }
                            }
                    }
                }
                catch { }
            }
            catch { }
            //byte[] pBufferdatas = new byte[dwBufSize];
            //pBufferdata.CopyTo(pBufferdatas, 0);
            //  System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(aabbcc), pBufferdata);

            System.Threading.Thread.Sleep(10);

        }