注册码显示逻辑修改
This commit is contained in:
commit
85bcc41e58
3 files changed
+64
-46
No files matched your search
+26
-32
@@ -17,7 +17,7 @@ namespace formula_manage.UserClass
|
||||
{
|
||||
public class TCPServer
|
||||
{
|
||||
|
||||
public static string infoR;
|
||||
//第一步:调用socket()函数创建一个用于通信的套接字
|
||||
public static Socket listenSocket;
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace formula_manage.UserClass
|
||||
get { return DateTime.Now.ToString("HH:mm:ss") + Environment.NewLine; }
|
||||
}
|
||||
|
||||
//编码格式
|
||||
Encoding econding = Encoding.Default;
|
||||
//编码格式
|
||||
public static Encoding econding = Encoding.Default;
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
@@ -81,9 +81,9 @@ namespace formula_manage.UserClass
|
||||
/// </summary>
|
||||
/// <param name="clientSocket"></param>
|
||||
public static void ReceiveMsg(Socket clientSocket)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
//定义一个2M的缓冲区
|
||||
byte[] buffer = new byte[1024 * 1024 * 2];
|
||||
|
||||
@@ -118,14 +118,16 @@ namespace formula_manage.UserClass
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// if (length > 0)
|
||||
// {
|
||||
// string info = econding.GetString(buffer, 0, length);
|
||||
// ShowMessage(info);
|
||||
// }
|
||||
}
|
||||
if (length > 0)
|
||||
{
|
||||
infoR = econding.GetString(buffer, 0, length);
|
||||
//ShowMessage(info);
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
Bn_Send(ip, infoR+"return");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
/// <summary>
|
||||
/// 在线列表更新
|
||||
@@ -162,32 +164,24 @@ namespace formula_manage.UserClass
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
/// <summary>
|
||||
/// 消息发送
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btn_Send_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.lst_Online.SelectedItem != null)
|
||||
{
|
||||
foreach (string item in this.lst_Online.SelectedItems)
|
||||
{
|
||||
if (OnLineList.ContainsKey(item))
|
||||
{
|
||||
OnLineList[item].Send(econding.GetBytes(this.txt_Send.Text.Trim()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("请先选择要发送的对象", "发送消息");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void Bn_Send(string IP ,string DAT)
|
||||
{
|
||||
|
||||
if (OnLineList.ContainsKey(IP))
|
||||
{
|
||||
OnLineList[IP].Send(econding.GetBytes(DAT));
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
/// <summary>
|
||||
/// 群发功能
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user