private void GetConnectNumber(int timeOut)
        {
            AutoResetEvent autoResetEvent = new AutoResetEvent(false);
            IntPtr         handle         = SharedMemoryStream.OpenEvent(1048578u, false, this.memoryName + "_CONNECT_REQUEST");

            autoResetEvent.Handle = (handle);
            AutoResetEvent autoResetEvent2 = new AutoResetEvent(false);

            handle = SharedMemoryStream.OpenEvent(1048578u, false, this.memoryName + "_CONNECT_ANSWER");
            autoResetEvent2.Handle = (handle);
            IntPtr hFileMappingObject = SharedMemoryStream.OpenFileMapping(2u, false, this.memoryName + "_CONNECT_DATA");
            IntPtr intPtr             = SharedMemoryStream.MapViewOfFile(hFileMappingObject, 2u, 0u, 0u, (IntPtr)4);

            if (!autoResetEvent.Set())
            {
                throw new MySqlException("Failed to open shared memory connection ");
            }
            autoResetEvent2.WaitOne(timeOut * 1000, false);
            this.connectNumber = Marshal.ReadInt32(intPtr);
        }
        private void SetupEvents()
        {
            string text = this.memoryName + "_" + this.connectNumber;

            this.dataMap     = SharedMemoryStream.OpenFileMapping(2u, false, text + "_DATA");
            this.dataView    = SharedMemoryStream.MapViewOfFile(this.dataMap, 2u, 0u, 0u, (IntPtr)16004);
            this.serverWrote = new AutoResetEvent(false);
            IntPtr handle = SharedMemoryStream.OpenEvent(1048578u, false, text + "_SERVER_WROTE");

            this.serverWrote.Handle = handle;
            this.serverRead         = new AutoResetEvent(false);
            handle = SharedMemoryStream.OpenEvent(1048578u, false, text + "_SERVER_READ");
            this.serverRead.Handle = handle;
            this.clientWrote       = new AutoResetEvent(false);
            handle = SharedMemoryStream.OpenEvent(1048578u, false, text + "_CLIENT_WROTE");
            this.clientWrote.Handle = handle;
            this.clientRead         = new AutoResetEvent(false);
            handle = SharedMemoryStream.OpenEvent(1048578u, false, text + "_CLIENT_READ");
            this.clientRead.Handle = handle;
            this.serverRead.Set();
        }