Esempio n. 1
0
        private void ButtonClicked2(object sender, RoutedEventArgs e)
        {
            byte[] outStream = System.Text.Encoding.ASCII.GetBytes("pu|sh$");
            serverStream.Write(outStream, 0, outStream.Length);
            serverStream.Flush();

            serverStream = clientSocket.GetStream();
            int buffSize = 0;

            byte[] inStream = new byte[100250];
            buffSize = clientSocket.ReceiveBufferSize;
            serverStream.Read(inStream, 0, inStream.Length);
            string returndata = System.Text.Encoding.ASCII.GetString(inStream);

            returndata = returndata.Substring(0, returndata.IndexOf("$"));

            if (returndata.Equals("OK"))
            {
                Window prchWindow = new PurchaseWindow(clientSocket);
                prchWindow.Show();
            }
            else
            {
                MessageBox.Show("Server returned " + returndata, returndata, MessageBoxButton.OK);
            }
        }
Esempio n. 2
0
 public NewClientWindow(TcpClient sock, PurchaseWindow parent)
 {
     p            = parent;
     clientSocket = sock;
     serverStream = clientSocket.GetStream();
     InitializeComponent();
 }