Example #1
0
 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();
     }
 }
Example #2
0
 public void SendData(GAISWriter gw)
 {
     if (connected)
     {
         GAISWriter gwSend = new GAISWriter(tcpClient.GetStream());
         gwSend.Write(gw.ToArray());
         gwSend.Flush();
     }
 }
Example #3
0
 //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);
     }
 }