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(); }
internal void DisconnectedCallback() { if (OnDisconnected != null) { nuiApp.Queue_Event(OnDisconnected, this); Clear(); } }
void client_ServerMessage(byte[] data) { if (data.Length != 0 && OnMessageReceived != null) { MessageReader reader = new MessageReader(data); nuiApp.Queue_Event(OnMessageReceived, reader); } }
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); } } }