• 大小: 102KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-10
  • 语言: C#
  • 标签: 聊天  C#  搜索  

资源简介

局域网聊天 无需服务器 自动搜索 在线用户 目前只能支持 局域网

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net.Sockets;
using System.Net;

namespace WindowsFormsApplication1
{
    public partial class charFrm : Form
    {
        private UdpClient _client;
        private IPEndPoint user;
        public charFrm()
        {
            InitializeComponent();       
        Middle.sendEvent += new Middle.SendMeage(updateTxt);
        }
        public charFrm(UdpClient clientIPEndPoint ip)
        {
            InitializeComponent();           
            _client = client; user = ip;
            Middle.sendEvent += new Middle.SendMeage(updateTxt);
        }
        private void updateTxt(byte[] data string name)
        {
            string title=this.Text.Split(‘ ‘)[2];
            if (name ==title)
            {
                richTextBox1.SelectionColor = Color.Blue;
                this.richTextBox1.AppendText(Encoding.UTF8.GetString(data)); this.richTextBox1.ScrollToCaret();
            }
        }

        private void button2_Click(object sender EventArgs e)
        {
            byte[] send = Encoding.UTF8.GetBytes(DateTime.Now.ToLongTimeString() + “:“ + FindComputer.locahName + “说\n“ + textBox1.Text+“\n“);
            _client.Send(send send.Length user);
            richTextBox1.SelectionColor = Color.Red;
            richTextBox1.AppendText(DateTime.Now.ToLongTimeString()+“Me:“+“\n“+textBox1.Text+“\n“);
            textBox1.Clear();
        }

        private void button1_Click(object sender EventArgs e)
        {
            this.Close();
        }

        private void charFrm_FormClosed(object sender FormClosedEventArgs e)
        {
            Middle.sendEvent -= new Middle.SendMeage(updateTxt);
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        852  2010-04-22 14:22  局域网聊天\WindowsFormsApplication1\app.config

     文件      30208  2010-07-03 16:39  局域网聊天\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe

     文件        852  2010-04-22 14:22  局域网聊天\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config

     文件      99840  2010-07-03 16:39  局域网聊天\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb

     文件      14328  2010-07-03 16:39  局域网聊天\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe

     文件        852  2010-04-22 14:22  局域网聊天\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config

     文件        490  2007-07-21 01:33  局域网聊天\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest

     文件       1898  2010-04-26 20:09  局域网聊天\WindowsFormsApplication1\charFrm.cs

     文件       3861  2010-04-22 21:30  局域网聊天\WindowsFormsApplication1\charFrm.Designer.cs

     文件       5814  2010-04-22 21:30  局域网聊天\WindowsFormsApplication1\charFrm.resx

     文件       1814  2010-04-22 17:17  局域网聊天\WindowsFormsApplication1\FindComputer.cs

     文件      15756  2010-07-03 16:50  局域网聊天\WindowsFormsApplication1\Form1.cs

     文件      10611  2010-07-03 16:27  局域网聊天\WindowsFormsApplication1\Form1.Designer.cs

     文件       6582  2010-07-03 16:27  局域网聊天\WindowsFormsApplication1\Form1.resx

     文件       1241  2010-04-29 22:12  局域网聊天\WindowsFormsApplication1\frmRecive.cs

     文件       2890  2010-04-26 21:29  局域网聊天\WindowsFormsApplication1\frmRecive.Designer.cs

     文件       6008  2010-04-26 21:29  局域网聊天\WindowsFormsApplication1\frmRecive.resx

     文件        415  2010-04-22 16:58  局域网聊天\WindowsFormsApplication1\Middle.cs

     文件       5120  2010-04-23 12:06  局域网聊天\WindowsFormsApplication1\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件        180  2010-04-26 21:21  局域网聊天\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.charFrm.resources

     文件       8654  2010-07-03 16:39  局域网聊天\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt

     文件        969  2010-07-03 16:27  局域网聊天\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache

     文件      30208  2010-07-03 16:39  局域网聊天\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.exe

     文件        180  2010-07-03 16:27  局域网聊天\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.Form1.resources

     文件        180  2010-04-26 21:29  局域网聊天\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.frmRecive.resources

     文件      99840  2010-07-03 16:39  局域网聊天\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.pdb

     文件        180  2010-04-26 21:21  局域网聊天\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.Properties.Resources.resources

     文件        485  2010-04-22 14:15  局域网聊天\WindowsFormsApplication1\Program.cs

     文件       1404  2010-04-22 14:15  局域网聊天\WindowsFormsApplication1\Properties\AssemblyInfo.cs

     文件       3158  2010-04-23 12:06  局域网聊天\WindowsFormsApplication1\Properties\Resources.Designer.cs

............此处省略22个文件信息

评论

共有 条评论