Exemplo n.º 1
0
        //2 parameter constructor
        public ChatClient(string _host, int _port)
        {
            _currentpath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

            //store the host string
            host = _host;

            //store the port number
            port = _port;


            //Get the connection
            try
            {
                tcpc        = Connect(host, port);
                stream      = tcpc.GetStream();
                _chatstream = new ChatStream(stream);

                // _chatstream.Stream = stream;
            }
            catch//(Exception e)
            {
                //Console.WriteLine(e);
                Environment.Exit(0);
            }



            //Initialize the GUI
            Control.CheckForIllegalCrossThreadCalls = false;

            InitializeComponent();
            // init_components();
            cfont       = new Font("Arial", 14);
            memberColor = new Hashtable();

            //Start Listening
            tl = new Thread(new ThreadStart(Listen));
            tl.SetApartmentState(ApartmentState.STA);
            tl.Start();
        }