Ejemplo n.º 1
0
        private void Log(string s)
        {
            var    now      = DateTime.Now;
            string currTime = now.Hour.ToString() + ':' +
                              now.Minute.ToString() + ':' +
                              now.Second.ToString() + ": ";

            lock (RchtxtLog)
            {
                RchtxtLog.AppendText(currTime + s + Environment.NewLine);

                RchtxtLog.SelectionStart = RchtxtLog.Text.Length;
                RchtxtLog.ScrollToCaret();
            }
        }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            PanelChat.BringToFront();
            RchtxtChat.BringToFront();
            RchtxtLog.BringToFront();

            members            = new List <Member>();
            pendingConnections = new List <IPAddress>();

            Global.Init();
            Broadcaster.Init();

            Log("My IP: " + Global.lanIp);
            Log("Mask: " + Global.lanMask);
            Log("Broad address: " + Broadcaster.broadAddr);

            Broadcaster.OnNewBroadcast = OnBroadcastReceived;
            Broadcaster.MemberCheck    = MemberAbsent;

            // Create tcp receiver socket
            tcpAccepter = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            tcpAccepter.Bind(Global.localEp);
        }