惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
N
Netflix TechBlog - Medium
Google Online Security Blog
Google Online Security Blog
月光博客
月光博客
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
M
MIT News - Artificial intelligence
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
H
Help Net Security
The Cloudflare Blog
Blog — PlanetScale
Blog — PlanetScale
F
Full Disclosure
G
Google Developers Blog
罗磊的独立博客
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
A
About on SuperTechFans
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
有赞技术团队
有赞技术团队
GbyAI
GbyAI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
The Register - Security
The Register - Security
U
Unit 42
D
Docker
Martin Fowler
Martin Fowler
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
阮一峰的网络日志
阮一峰的网络日志
C
Cybersecurity and Infrastructure Security Agency CISA
博客园_首页
Google DeepMind News
Google DeepMind News

博客园 - BearOcean

LOG.ZS.0001.基于Freetype的游戏字体渲染优化思路 const 和指针 C++ 下啥时候用struct, 啥时候用class C++ 和 Java 中的变参 解决站点关键数据,状态数据,无须持久化数据的一些思路 BS程序代码与安全与基本攻击/防御模式 Struts 实现的I18N Ant 阅读笔记 进度,效率,与个人事务管理 Personal Task 1.0 MySql与Java的时间类型 数据挖掘概述 解决Thread 的关闭问题和参数传递时想到的办法. Command 模式 .Net标准控件与自定义控件(2) ToolTipButton 内网聊天工具FreeChat 2.0 FreeChat 2.0 ...大改 模型和架构 局域网聊天工具FreeChat 1.0 开发日志 为Socket写的附加方法 .Net 事件
内网聊天工具FreeChat Beta
BearOcean · 2006-01-18 · via 博客园 - BearOcean

今天自己做了一个小软件,取名叫FreeChat
主要的用途是局域网内聊天,主要用到.net  的Socket类.Thread并自己封装了数据包.

下载地址:/Files/BearOcean/FreeChat(Beta).rar

现在作为Beta版发布...也把源代码发出来.我是菜鸟.希望高手不要鄙视.因为是基于.net的,所以至少需要FrameWork1.1

使用说明如下图:


很简单...在1.0中想添加一些其他的功能.比如允许文件传送,而且觉得输入IP或者计算机名的方式有点麻烦.

原代码如下:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

using System.Net;
using System.Net.Sockets;
using System.Text;
using System.IO;
using System.Threading;

namespace FreeChat
{
    
    
    
public class FmFreeChat : System.Windows.Forms.Form
    
{
        
const int MSGINFOLENGTH=10;
        
const int MSGREMOTENAME=20;
        
const int MAXPACKSIZE=100;

        
private System.Windows.Forms.Button BtSend;
        
private System.Windows.Forms.Button BtExit;
        
private System.Windows.Forms.RichTextBox RtxSend;
        
private System.Windows.Forms.RichTextBox RtxInfo;
        
private System.Windows.Forms.Label LbComName;
        
private System.Windows.Forms.TextBox TxtTarget;

        
private IPHostEntry hostentryHost;
        
private IPEndPoint endpointHost;
        
private Socket sockListener;
        
private Thread thWorker;
        
private System.Windows.Forms.MenuItem menuItem1;
        
private System.Windows.Forms.MainMenu MeunFreeChat;
        
private System.Windows.Forms.MenuItem menuItemSave;
        
private System.Windows.Forms.MenuItem menuItemSaveClear;
        
private System.Windows.Forms.MenuItem menuItemClear;
        
private System.Windows.Forms.MenuItem menuItemHelp;
        
private System.Windows.Forms.MenuItem menuItemAbFreeChat;
        
private System.Windows.Forms.MenuItem menuItemAbMe;
        
private System.Windows.Forms.MenuItem menuItem6;
        
private System.Windows.Forms.MenuItem menuItem7;
        
private System.Windows.Forms.MenuItem menuItem8;
        
        
private System.ComponentModel.Container components = null;

        
public FmFreeChat()
        
{
            InitializeComponent();        
        }


        
Dispose

        
Windows
        
        [STAThread]

        
Main

        
FreeChatInit

        
WorkerProc

        
FmFreeChat_Load

        
BtExit_Click

        
BtSend_Click

        
RtxInfo_TextChanged

        
menuItemClear

        
RecordSave

        
menuItemSave

        
menuItemSaveClear

        
menuItemAbFreeChat

        
menuItemAbMe

        
        
    }

}

然后是负责储存聊天记录的部分:

using System;
using System.Windows.Forms;
using System.IO;

namespace FreeChat
{
    
/// <summary>
    
/// Record 
    
/// </summary>

    public class Record
    
{
        
public Record()
        
{
            
        }


        
public static void RecordMessage(string strMessage)//CreateDirectory And File
        {
            Directory.CreateDirectory(
"FreeChatLogs");
            DateTime dt
=DateTime.Now;
            
string today=dt.ToString("yyyy-MM-dd");
            
string strRecordTime=dt.ToString("yyyy-MM-dd:HH:mm:ff");

            StreamWriter swRecordFile
=new StreamWriter(String.Concat("FreeChatLogs\\",today,".chat"),true,System.Text.Encoding.UTF8);
            swRecordFile.WriteLine(String.Concat(
"RecordTime:",strRecordTime));
            swRecordFile.WriteLine(
"------------------------------------------------------------------");
            swRecordFile.Write(strMessage);
            swRecordFile.Write(
"\n\n\n\n\n");
            swRecordFile.Close();

            MessageBox.Show(
"Record Success","FreeChat");
            
        }

    }

}


代码基本上就是这些.1.0肯定会对它进行补全和修改,还有功能添加.