public void SendData(GAISWriter gw) { if (connected) { GAISWriter gwSend = new GAISWriter(tcpClient.GetStream()); gwSend.Write(gw.ToArray()); gwSend.Flush(); } }
public void SendData(Byte[] arr) { if (connected) { GAISWriter gw = new GAISWriter(); gw.Write((Int32)OPCODE.VIDEO_UPDATE); gw.Write(Nick); gw.Write(arr.Length); gw.Write(arr); GAISWriter gwSend = new GAISWriter(tcpClient.GetStream()); gwSend.Write(gw.ToArray()); gwSend.Flush(); } }
//Constructor //It starts the client thread and connects to server public Client(String nick, String ip, Int32 port, MainForm form) { try { pForm = form; tcpClient = new TcpClient(); Nick = nick; tcpClient.Connect(ip, port); connected = true; t = new Thread(new ThreadStart(Run)); t.Start(); GAISWriter gw = new GAISWriter(); gw.Write((Int32)OPCODE.REGISTER); gw.Write(nick); SendData(gw); } catch (Exception e) { MessageBox.Show("Cannot connect" + e.Message); pForm.SetVisibility(true); } }
public void Write(GAISWriter ww) { this.Write(ww.ToArray()); }