Example #1
0
 public static void startInit(TcpClient tcpClient)
 {
     userForm ui = new userForm();
     serverTCP = tcpClient;
     try
     {
         Stream serverSendStream = tcpClient.GetStream();
     }
     // catch error on connecting to a server
     catch (Exception e)
     {
         Console.WriteLine("Error..... " + e.StackTrace);
     }
 }
Example #2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Client theClient = new Client();
               // TcpClient serverSocket;
            userForm ui = new userForm();
            paramsForThread parameters= new paramsForThread();
            parameters.IPAddress= args[0];
            parameters.portNumber = Convert.ToInt32(args[1]);
            //new ParameterizedThreadStart((object) args)
            ParameterizedThreadStart initialize = new ParameterizedThreadStart(Start);
            Thread newThread = new Thread(initialize);
               // Client.startInit();
            newThread.Start(parameters);

            Application.Run(new splashScreen());
        }
Example #3
0
 private void enterClassesButton_Click(object sender, EventArgs e)
 {
     userForm displayForm = new userForm();
     displayForm.Show();
     this.Hide();
 }
Example #4
0
    public static void startInit(TcpClient tcpClient)
    {
        // Thread clientThreads = new Thread();

        userForm ui = new userForm();
          //  const int DOMAIN_NAME_ARG = 0;
           // const int PORT_NUMBER_ARG = 1;

        serverTCP = tcpClient;
        try
        {
          //************ // TcpClient Tcpclnt = new TcpClient();
          //  Console.WriteLine("Connecting.....");
          //  ****************int portNumber = Convert.ToInt32(argv[PORT_NUMBER_ARG]);
           //     *****************int portNumber = 8001;
         //   string serverIP = "127.0.0.1";
          // ******* //connect(Tcpclnt, serverIP, portNumber);
            //while (Console.ReadLine() != "Close")
            //{
            //   sendMessage(Tcpclnt);
            String sendString;
            Stream serverSendStream = tcpClient.GetStream();
            //String sendString = "Hellllllllloooooooooooooooooooooooooooooooooooooooooooooooo";
            ASCIIEncoding asen = new ASCIIEncoding();
           // byte[] bytesInSend;
            //Console.WriteLine("Transmitting.....");

         //   sendMessage(tcpClient);
            while (true)
            {

                const string EXIT_STRING = "exit";
                //if (ui.checkButton() == true)
                //{

                //    sendString = ui.readUserInput();
                //    sendMessageUI(tcpClient, sendString);
                //    if (sendString.ToLower() == EXIT_STRING)
                //        break;
                //}

              //  string userInput = ui.readUserInput();
                //sendString = sendMessage(Tcpclnt);

                //sendString = Console.ReadLine();
                //  //MIGHT NEEEEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDd
                ////sendString += "\n\r";
                //bytesInSend= asen.GetBytes(sendString);
                //serverSendStream.Write(bytesInSend, 0, bytesInSend.Length);
                //serverSendStream.Flush();
            //    if (sendString.ToLower() == EXIT_STRING)
              //      break;
            }
            //   receiveMessage(Tcpclnt);

            ////

            //byte[] bytesToRead = new byte[100];
            //int numberOfBytesRead = serverSendStream.Read(bytesToRead, 0, bytesToRead.Length);

            //for (int i = 0; i < numberOfBytesRead; i++)
            //    Console.Write(Convert.ToChar(bytesToRead[i]));
            //   }
            //**************tcpClient.Close();
        }

        catch (Exception e)
        {
            Console.WriteLine("Error..... " + e.StackTrace);
        }
    }