2024年3月23日发(作者:)

实现用C#做一个聊天室

客户端的代码:

using System;

using c;

using entModel;

using ;

using g;

using ;

using ;

using s;

using ;

namespace EasyChat

{

public partial class login_frm : Form

{

///

/// IP地址

///

private IPAddress _ipAddr;

#region 登录窗体构造函数

///

/// 构造函数,自动生成

///

public login_frm()

{

InitializeComponent();

}

#endregion

#region 登录窗体的私有方法

///

/// 验证登录信息

///

/// 验证结果

private bool ValidateInfo()

{

1

if (user_() == )

{

("请填写用户名!",

"提示",

,

ation);

return false;

}

if (!se(svrip_, out _ipAddr))

{

("IP地址不合法!",

"提示",

,

ation);

return false;

}

int _port;

if (!se(svrport_, out _port))

{

("端口号不合法!",

"提示",

,

ation);

return false;

}

else

{

if (_port < 1024 || _port > 65535)

{

("端口号不合法!",

"提示",

,

ation);

return false;

}

}

return true;

}

///

/// 取消,关闭窗体

///

///

2