Esempio n. 1
0
 public Client(TcpClient inClientSocket, InventoryServerForm siht)
 {
     ClientSocket                 = inClientSocket;
     ClientSocket.NoDelay         = true;
     bgwWaitForPCRequests.DoWork += new DoWorkEventHandler(bgwWaitForPCRequests_DoWork);
     //bgwWaitForPCRequests.ProgressChanged += new ProgressChangedEventHandler(bgwWaitForPCRequests_ProgressChanged);
     //bgwWaitForPCRequests.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgwWaitForPCRequests_RunWorkerCompleted);
     startClient(siht);
 }
Esempio n. 2
0
 public void StreamDataToClient(byte[] dataToSend, InventoryServerForm siht)
 {
     try {
         //siht.UpdateStatus(" >> Sending data to " + UserName);
         NetworkStream outStream = ClientSocket.GetStream();
         outStream.Write(dataToSend, 0, dataToSend.Length);
         outStream.Flush();
     } catch (Exception ex) {
         siht.UpdateStatus("XXX " + ex.Message);
     }
 }
Esempio n. 3
0
 /// <summary>
 ///     this creates and starts the tread for the client object, on the server.
 /// </summary>
 private bool startClient(InventoryServerForm siht)
 {
     byte[] InStream = new byte[10025];
     try {
         ClientSocket.GetStream().Read(InStream, 0, ClientSocket.ReceiveBufferSize);
         NamePacket handshake = new NamePacket(InStream);
         if (handshake.Name != string.Empty && handshake.Name != null)
         {
             UserName = handshake.Name;
         }
         else
         {
             UserName = "******" + UserCount++.ToString();
         }
     } catch (Exception ex) {
         siht.UpdateStatus("XXX " + ex.Message);
         return(false);
     }
     bgwWaitForPCRequests.RunWorkerAsync(siht);
     return(true);
 }