Exemplo n.º 1
0
 void client_Error()
 {
     if (OnClientDisconnected != null)
     {
         nuiApp.Queue_Event(OnClientDisconnected);
     }
 }
        //받기 위한 연결시작
        public void Start()
        {
            this.handle =
                Win32APIs.CreateFile(
                    this.pipeName,
                    GENERIC_READ,
                    0,
                    IntPtr.Zero,
                    OPEN_EXISTING,
                    FILE_FLAG_OVERLAPPED,
                    IntPtr.Zero);

            //서버가 동작을 안하고있음
            if (this.handle.IsInvalid)
            {
                if (Error != null)
                {
                    nuiApp.Queue_Event(Error);
                }
                return;
            }

            this.stream = new FileStream(this.handle, FileAccess.Read, BUFFER_SIZE, true);

            WaitForData();
        }
Exemplo n.º 3
0
 internal void DisconnectedCallback()
 {
     if (OnDisconnected != null)
     {
         nuiApp.Queue_Event(OnDisconnected, this);
         Clear();
     }
 }
Exemplo n.º 4
0
        void client_ServerMessage(byte[] data)
        {
            if (data.Length != 0 && OnMessageReceived != null)
            {
                MessageReader reader = new MessageReader(data);

                nuiApp.Queue_Event(OnMessageReceived, reader);
            }
        }
Exemplo n.º 5
0
 private void WaitForData(SocketInfo socketInfo)
 {
     try
     {
         _socket.BeginReceive(socketInfo.Buffer,
                              socketInfo.Index,
                              socketInfo.Buffer.Length - socketInfo.Index,
                              SocketFlags.None,
                              new AsyncCallback(OnDataReceived),
                              socketInfo);
     }
     catch (Exception e)
     {
         if (OnClientDisconnected != null)
         {
             nuiApp.Queue_Event(OnClientDisconnected);
         }
     }
 }