示例#1
0
        private void 서버개설ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            listenSocket.Bind(new IPEndPoint(MySock.GetMyIP(), 10200));
            listenSocket.Listen(10);

            acceptThread = new Thread(new ThreadStart(AcceptLoop));
            acceptThread.Start();
        }
示例#2
0
        private void bt_send_Click(object sender, EventArgs e)
        {
            string msg = MySock.GetMyIP().ToString() + "::" + tb_msg.Text;

            try
            {
                workerSocket.Send(Encoding.Default.GetBytes(msg));
                lb_msgs.Items.Add(msg);
            }
            catch (Exception)
            {
            }
        }