예제 #1
0
        private void NewConnection(Socket clientSock)
        {
            pClient client = new pClient(clientSock);
            clientList.Add(client);
            ListViewItem item = new ListViewItem();
            ListViewItem.ListViewSubItemCollection subitems = new ListViewItem.ListViewSubItemCollection(item);
            item.Tag = client;

            EditListView(item,subitems);

            byte[] HelloMess = ENCODE.GetBytes("Welcome " + DateTime.Now.ToLongTimeString());
            client.socket.Send(HelloMess, HelloMess.Length, 0);
            client.SetupForRecv(this);
        }
예제 #2
0
        /// <summary>
        /// tạo kết nối mới cho client dc chấp nhận 
        /// </summary>
        /// <param name="clientSock"></param>
        /// <param name="id"></param>
        private void NewConnection(Socket clientSock, PlayerID id)
        {
            pClient client = new pClient(clientSock, id);

            _PlayerList.Add(client);
            ListViewItem item = new ListViewItem();
            ListViewItem.ListViewSubItemCollection subitems = new ListViewItem.ListViewSubItemCollection(item);
            item.Tag = client;

            GUI.EditListView(item, subitems);

            byte[] Helo = _ENCODE.GetBytes("HELO\n" + GUI.timeOutSecond.ToString() + "\n" + GUI._ContainerList.Capacity.ToString() + "\n" + "Connected at: " + DateTime.Now.ToLongTimeString());
            client.sock.Send(Helo);
            client.SetupForRecv(this);
        }