|
|
|
@ -6,15 +6,19 @@ using Highway.Assemble.Sql;
|
|
|
|
|
using Highway.Assemble.SqlSugar.serviceImpl;
|
|
|
|
|
using Highway.SocketServer;
|
|
|
|
|
using HighWayAssemble.Protocol;
|
|
|
|
|
using RRQMCore.XREF.Newtonsoft.Json.Serialization;
|
|
|
|
|
using RRQMSocket;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.Sockets;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using TouchSocket.Core;
|
|
|
|
|
using TouchSocket.Http;
|
|
|
|
|
using TouchSocket.Rpc;
|
|
|
|
|
using TouchSocket.Sockets;
|
|
|
|
|
using IPHost = TouchSocket.Sockets.IPHost;
|
|
|
|
|
using SocketClient = TouchSocket.Sockets.SocketClient;
|
|
|
|
@ -34,11 +38,12 @@ namespace HighWayAssemble
|
|
|
|
|
// IConfigInfo configInfo = null;
|
|
|
|
|
ISoftInfo SoftInfo = null;
|
|
|
|
|
public static IAsyncSocketServer SocketServer = null;
|
|
|
|
|
public static MesHttpClient MesHttpClient = null;
|
|
|
|
|
IBoxDB m_BoxDB = null;
|
|
|
|
|
IEquipClient m_EquipClient = null;
|
|
|
|
|
private List<IOInfo> IO_Infolist = new List<IOInfo>();
|
|
|
|
|
private List<IOInfo> IO_OUTfolist = new List<IOInfo>();
|
|
|
|
|
private List<SocketClient> onLineClient;
|
|
|
|
|
private List<TcpSessionClient> onLineClient;
|
|
|
|
|
private SimpleTcpService tcpService;
|
|
|
|
|
private TcpService m_service;
|
|
|
|
|
List<byte[]> bufferlit = new List<byte[]>();
|
|
|
|
@ -65,11 +70,42 @@ namespace HighWayAssemble
|
|
|
|
|
Sql = App.Make<ISql>(SoftInfo.CollectInfo.sqlstring);
|
|
|
|
|
GetSoftInfo();
|
|
|
|
|
m_EquipClient = App.Make<IEquipClient>();
|
|
|
|
|
//创建webapi
|
|
|
|
|
|
|
|
|
|
var t = Task.Run(async delegate
|
|
|
|
|
{
|
|
|
|
|
await Task.Delay(10);
|
|
|
|
|
CreateTcp();
|
|
|
|
|
MesHttpClient = new MesHttpClient();
|
|
|
|
|
MesHttpClient.init();
|
|
|
|
|
var service = new HttpService();
|
|
|
|
|
await service.SetupAsync(new TouchSocketConfig()
|
|
|
|
|
.SetListenIPHosts(6001)
|
|
|
|
|
.ConfigureContainer(a =>
|
|
|
|
|
{
|
|
|
|
|
a.AddConsoleLogger();
|
|
|
|
|
a.AddRpcStore(store =>
|
|
|
|
|
{
|
|
|
|
|
store.RegisterServer<ApiServer>();//注册服务
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.ConfigurePlugins(a =>
|
|
|
|
|
{
|
|
|
|
|
a.UseCheckClear();
|
|
|
|
|
|
|
|
|
|
a.UseWebApi()
|
|
|
|
|
.ConfigureConverter(converter =>
|
|
|
|
|
{
|
|
|
|
|
converter.AddJsonSerializerFormatter(new Newtonsoft.Json.JsonSerializerSettings() { Formatting = Newtonsoft.Json.Formatting.None });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//此插件是http的兜底插件,应该最后添加。作用是当所有路由不匹配时返回404.且内部也会处理Option请求。可以更好的处理来自浏览器的跨域探测。
|
|
|
|
|
a.UseDefaultHttpServicePlugin();
|
|
|
|
|
}
|
|
|
|
|
));
|
|
|
|
|
await service.StartAsync();
|
|
|
|
|
await m_service.StartAsync();//启动
|
|
|
|
|
|
|
|
|
|
//CreatSocketServer();
|
|
|
|
|
InitEquipClient();
|
|
|
|
|
if (IsOPCFlag == 1)
|
|
|
|
@ -134,7 +170,7 @@ namespace HighWayAssemble
|
|
|
|
|
public int Length;
|
|
|
|
|
public byte[] data;
|
|
|
|
|
public long time;
|
|
|
|
|
internal SocketClient SocketClient;
|
|
|
|
|
internal TcpSessionClient SocketClient;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 创建OPC客户端
|
|
|
|
@ -313,7 +349,7 @@ namespace HighWayAssemble
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
info = MsgUtil.bytesToHexStr(data, data.Length);
|
|
|
|
|
//info = MsgUtil.bytesToHexStr(data, data.Length);
|
|
|
|
|
}
|
|
|
|
|
App.TriggerHalt(EventSystem.updateSensorListInfo, id, info);
|
|
|
|
|
//Sql.InsertReadData(id.ToString(), info, 0);
|
|
|
|
@ -321,12 +357,12 @@ namespace HighWayAssemble
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Head head = new Head();
|
|
|
|
|
head.start = 0x56;
|
|
|
|
|
short addr = GetMESCallback(id);
|
|
|
|
|
head.addr = addr;
|
|
|
|
|
head.mstaseq = 241;
|
|
|
|
|
head.control = 125 + 4;
|
|
|
|
|
//Head head = new Head();
|
|
|
|
|
//head.start = 0x56;
|
|
|
|
|
//short addr = GetMESCallback(id);
|
|
|
|
|
//head.addr = addr;
|
|
|
|
|
//head.mstaseq = 241;
|
|
|
|
|
//head.control = 125 + 4;
|
|
|
|
|
byte[] dataInfo;
|
|
|
|
|
string info = "";
|
|
|
|
|
if (data == null)
|
|
|
|
@ -345,39 +381,48 @@ namespace HighWayAssemble
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dataInfo = data;// dataInfo = Encoding.ASCII.GetBytes(MsgUtil.bytesToHexStr(data, data.Length));//dataInfo = data;
|
|
|
|
|
info = MsgUtil.bytesToHexStr(data, data.Length);
|
|
|
|
|
if (data != null && data.Any())
|
|
|
|
|
{
|
|
|
|
|
info = string.Join(",", data.Select(item => item.EPCstring));
|
|
|
|
|
}
|
|
|
|
|
var num = BitConverter.GetBytes(id);
|
|
|
|
|
// = Encoding.ASCII.GetBytes(data);
|
|
|
|
|
head.length = (Int16)(4 + dataInfo.Length);
|
|
|
|
|
var headbuf = MsgUtil.StructToBytes(head);
|
|
|
|
|
byte[] sendbuf = new byte[7 + 4 + dataInfo.Length + 3];
|
|
|
|
|
Array.Copy(headbuf, 0, sendbuf, 0, headbuf.Length);
|
|
|
|
|
Array.Copy(num, 0, sendbuf, 7, num.Length);
|
|
|
|
|
Array.Copy(dataInfo, 0, sendbuf, 7 + 4, dataInfo.Length);
|
|
|
|
|
byte[] Verify = MsgUtil.CalculateVerify(sendbuf, sendbuf.Length - 3);
|
|
|
|
|
// Message[Message.Length - 2] = Verify;
|
|
|
|
|
Array.Copy(Verify, 0, sendbuf, sendbuf.Length - 3, 2);
|
|
|
|
|
sendbuf[sendbuf.Length - 1] = 0x86;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
info = string.Empty; // 处理空集合的情况
|
|
|
|
|
}
|
|
|
|
|
//dataInfo = data;
|
|
|
|
|
// dataInfo = Encoding.ASCII.GetBytes(MsgUtil.bytesToHexStr(data, data.Length));//dataInfo = data;
|
|
|
|
|
|
|
|
|
|
//info = MsgUtil.bytesToHexStr(data, data.Length);
|
|
|
|
|
//info = Encoding.ASCII.GetString(data, 0, data.Length);
|
|
|
|
|
}
|
|
|
|
|
//var num = BitConverter.GetBytes(id);
|
|
|
|
|
//head.length = (Int16)(4 + dataInfo.Length);
|
|
|
|
|
//var headbuf = MsgUtil.StructToBytes(head);
|
|
|
|
|
//byte[] sendbuf = new byte[7 + 4 + dataInfo.Length + 3];
|
|
|
|
|
//Array.Copy(headbuf, 0, sendbuf, 0, headbuf.Length);
|
|
|
|
|
//Array.Copy(num, 0, sendbuf, 7, num.Length);
|
|
|
|
|
//Array.Copy(dataInfo, 0, sendbuf, 7 + 4, dataInfo.Length);
|
|
|
|
|
//byte[] Verify = MsgUtil.CalculateVerify(sendbuf, sendbuf.Length - 3);
|
|
|
|
|
//Array.Copy(Verify, 0, sendbuf, sendbuf.Length - 3, 2);
|
|
|
|
|
//sendbuf[sendbuf.Length - 1] = 0x86;
|
|
|
|
|
App.TriggerHalt(EventSystem.updateSensorListInfo, id, info);
|
|
|
|
|
var token = SendMessageToClient(addr, sendbuf);
|
|
|
|
|
FrmDisplayView.LogInfo.Info(string.Format("发送MES主动读取到的数据 MES地址:{0},消息内容:{1} --{2}", addr, MsgUtil.bytesToHexStr(sendbuf, sendbuf.Length), token == null ? "MES断开" : ""));
|
|
|
|
|
//var token = SendMessageToClient(addr, sendbuf);
|
|
|
|
|
//FrmDisplayView.LogInfo.Info(string.Format("发送MES主动读取到的数据 MES地址:{0},消息内容:{1} --{2}", addr, MsgUtil.bytesToHexStr(sendbuf, sendbuf.Length), token == null ? "MES断开" : ""));
|
|
|
|
|
//2022-11-17 添加注释,等待时间10s
|
|
|
|
|
//Sql.InsertReadData(id.ToString(), info, 0);
|
|
|
|
|
await InsertRealWorkData(id.ToString(), info, 0);
|
|
|
|
|
//await InsertRealWorkData(id.ToString(), info, 0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//传感器数据回调 主动读取EPC 125+3
|
|
|
|
|
m_EquipClient.RecSendData(async (id, data) =>
|
|
|
|
|
{
|
|
|
|
|
Head head = new Head();
|
|
|
|
|
head.start = 0x56;
|
|
|
|
|
short addr = GetMESCallback(id);
|
|
|
|
|
head.addr = addr;
|
|
|
|
|
head.mstaseq = 241;
|
|
|
|
|
head.control = 125 + 3;
|
|
|
|
|
//Head head = new Head();
|
|
|
|
|
//head.start = 0x56;
|
|
|
|
|
//short addr = GetMESCallback(id);
|
|
|
|
|
//head.addr = addr;
|
|
|
|
|
//head.mstaseq = 241;
|
|
|
|
|
//head.control = 125 + 3;
|
|
|
|
|
byte[] dataInfo;
|
|
|
|
|
string info = "";
|
|
|
|
|
if (data == null)
|
|
|
|
@ -394,36 +439,51 @@ namespace HighWayAssemble
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dataInfo = data;// dataInfo = Encoding.ASCII.GetBytes(MsgUtil.bytesToHexStr(data, data.Length));//dataInfo = data;
|
|
|
|
|
info = MsgUtil.bytesToHexStr(data, data.Length);
|
|
|
|
|
if (data != null && data.Any())
|
|
|
|
|
{
|
|
|
|
|
info = string.Join(",", data.Select(item => item.EPCstring));
|
|
|
|
|
}
|
|
|
|
|
var num = BitConverter.GetBytes(id);
|
|
|
|
|
// byte[] dataInfo = Encoding.ASCII.GetBytes(data);
|
|
|
|
|
head.length = (Int16)(4 + dataInfo.Length);
|
|
|
|
|
var headbuf = MsgUtil.StructToBytes(head);
|
|
|
|
|
byte[] sendbuf = new byte[7 + 4 + dataInfo.Length + 3];
|
|
|
|
|
Array.Copy(headbuf, 0, sendbuf, 0, headbuf.Length);
|
|
|
|
|
Array.Copy(num, 0, sendbuf, 7, num.Length);
|
|
|
|
|
Array.Copy(dataInfo, 0, sendbuf, 7 + 4, dataInfo.Length);
|
|
|
|
|
byte[] Verify = MsgUtil.CalculateVerify(sendbuf, sendbuf.Length - 3);
|
|
|
|
|
Array.Copy(Verify, 0, sendbuf, sendbuf.Length - 3, 2);
|
|
|
|
|
sendbuf[sendbuf.Length - 1] = 0x86;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
info = string.Empty; // 处理空集合的情况
|
|
|
|
|
}
|
|
|
|
|
//dataInfo = data;// dataInfo = Encoding.ASCII.GetBytes(MsgUtil.bytesToHexStr(data, data.Length));//dataInfo = data;
|
|
|
|
|
//info = MsgUtil.bytesToHexStr(data, data.Length);
|
|
|
|
|
//info = Encoding.ASCII.GetString(data, 0, data.Length);
|
|
|
|
|
}
|
|
|
|
|
//var num = BitConverter.GetBytes(id);
|
|
|
|
|
//// byte[] dataInfo = Encoding.ASCII.GetBytes(data);
|
|
|
|
|
//head.length = (Int16)(4 + dataInfo.Length);
|
|
|
|
|
//var headbuf = MsgUtil.StructToBytes(head);
|
|
|
|
|
//byte[] sendbuf = new byte[7 + 4 + dataInfo.Length + 3];
|
|
|
|
|
//Array.Copy(headbuf, 0, sendbuf, 0, headbuf.Length);
|
|
|
|
|
//Array.Copy(num, 0, sendbuf, 7, num.Length);
|
|
|
|
|
//Array.Copy(dataInfo, 0, sendbuf, 7 + 4, dataInfo.Length);
|
|
|
|
|
//byte[] Verify = MsgUtil.CalculateVerify(sendbuf, sendbuf.Length - 3);
|
|
|
|
|
//Array.Copy(Verify, 0, sendbuf, sendbuf.Length - 3, 2);
|
|
|
|
|
//sendbuf[sendbuf.Length - 1] = 0x86;
|
|
|
|
|
App.TriggerHalt(EventSystem.updateSensorListInfo, id, info);
|
|
|
|
|
|
|
|
|
|
var token = SendMessageToClient(addr, sendbuf);
|
|
|
|
|
FrmDisplayView.LogInfo.Info(string.Format("发送MES触发读取数据 MES地址:{0},消息内容:{1} --{2}", addr, MsgUtil.bytesToHexStr(sendbuf, sendbuf.Length), token == null ? "MES断开" : ""));
|
|
|
|
|
//var token = SendMessageToClient(addr, sendbuf);
|
|
|
|
|
//FrmDisplayView.LogInfo.Info(string.Format("发送MES触发读取数据 MES地址:{0},消息内容:{1} --{2}", addr, MsgUtil.bytesToHexStr(sendbuf, sendbuf.Length), token == null ? "MES断开" : ""));
|
|
|
|
|
//2022-11-17 添加注释,等待时间10s
|
|
|
|
|
//Sql.InsertReadData(id.ToString(), info, 2);
|
|
|
|
|
await InsertRealWorkData(id.ToString(), info, 2);
|
|
|
|
|
MesParaData mesParaData = new MesParaData();
|
|
|
|
|
mesParaData.EQUID = id.ToString();
|
|
|
|
|
mesParaData.EPCID = info;
|
|
|
|
|
mesParaData.READSTATUS = info == "NoData" ? "1" : "0";
|
|
|
|
|
mesParaData.READTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
//MesHttpClient.autoread(mesParaData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//await InsertRealWorkData(id.ToString(), info, 2);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
//自报数据回调
|
|
|
|
|
m_EquipClient.RecAutoData(async (id, data) =>
|
|
|
|
|
{
|
|
|
|
|
//if (IsRepeat(id, data)) //判断光电抖动
|
|
|
|
|
//{
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//MesHttpClient.autoread();
|
|
|
|
|
|
|
|
|
|
string info = "";
|
|
|
|
|
byte[] dataInfo;
|
|
|
|
|
if (data == null)
|
|
|
|
@ -698,7 +758,7 @@ namespace HighWayAssemble
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tokens[i].SendAsync(Heartbuf, 0, 10);
|
|
|
|
|
tokens[i].SendAsync(Heartbuf);
|
|
|
|
|
FrmDisplayView.LogInfo.ErrorFormat("已连接MES软件编号:" + tokens[i].Id + ",MES软件地址:{0} ,端口号:{1},发送MES软件心跳报文:{2}", tokens[i].IP, tokens[i].Port, MsgUtil.bytesToHexStr(Heartbuf, Heartbuf.Length));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -971,35 +1031,29 @@ namespace HighWayAssemble
|
|
|
|
|
{
|
|
|
|
|
if (m_service == null)
|
|
|
|
|
{
|
|
|
|
|
onLineClient = new List<SocketClient>();
|
|
|
|
|
onLineClient = new List<TcpSessionClient>();
|
|
|
|
|
m_service = new TcpService();
|
|
|
|
|
m_service.Connected = this.M_service_Connected;//有客户端连接
|
|
|
|
|
m_service.Disconnected = this.M_service_Disconnected;//有客户端断开连接
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//m_service.Connected = this.M_service_Connected;//有客户端连接
|
|
|
|
|
//m_service.Closed = this.M_service_Disconnected;//有客户端断开连接
|
|
|
|
|
//这里应该引入多线程并加锁处理
|
|
|
|
|
m_service.Received += (client, byteBlock, requestInfo) =>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//接收信息,在CustomDataHandlingAdapter派生的适配器中,byteBlock将为null,requestInfo将为适配器定义的泛型
|
|
|
|
|
if (requestInfo is MyRequestInfo myRequestInfo)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
FrmDisplayView.LogInfo.Info("》》》接收[" + client.IP + ":" + client.Port + "]客户端原始消息: " + MsgUtil.bytesToHexStr(myRequestInfo.Header, (int)myRequestInfo.Header.Length) + MsgUtil.bytesToHexStr(myRequestInfo.Body, (int)myRequestInfo.Body.Length) + "\r\n");
|
|
|
|
|
//此处可以处理MyFixedHeaderRequestInfo的相关信息了。
|
|
|
|
|
ParsingMessages(client, myRequestInfo);
|
|
|
|
|
|
|
|
|
|
string body = Encoding.UTF8.GetString(myRequestInfo.Body, 0, myRequestInfo.Body.Length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
//m_service.Received += (client,e) =>
|
|
|
|
|
//{
|
|
|
|
|
// //从客户端收到信息
|
|
|
|
|
// var mes = e.ByteBlock.Span;
|
|
|
|
|
// //FrmDisplayView.LogInfo.Info("》》》接收[" + client.IP + ":" + client.Port + "]客户端原始消息: " + MsgUtil.bytesToHexStr(myRequestInfo.Header, (int)myRequestInfo.Header.Length) + MsgUtil.bytesToHexStr(myRequestInfo.Body, (int)myRequestInfo.Body.Length) + "\r\n");
|
|
|
|
|
// //此处可以处理MyFixedHeaderRequestInfo的相关信息了。
|
|
|
|
|
// ParsingMessages(client, e.ByteBlock);
|
|
|
|
|
//};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_service.Setup(new TouchSocketConfig()//载入配置
|
|
|
|
|
.SetListenIPHosts(new IPHost[] { new IPHost("0.0.0.0:" + SoftInfo.CollectInfo.Port) })//同时监听两个地址
|
|
|
|
|
.SetTcpDataHandlingAdapter(() => { return new MyFixedHeaderCustomDataHandlingAdapter(); })//配置适配器
|
|
|
|
|
//.SetTcpDataHandlingAdapter(() => { return new MyFixedHeaderCustomDataHandlingAdapter(); })//配置适配器
|
|
|
|
|
.SetMaxCount(10000)
|
|
|
|
|
.SetThreadCount(1000)
|
|
|
|
|
.SetCacheTimeoutEnable(false)
|
|
|
|
|
.ConfigureContainer(a =>//容器的配置顺序应该在最前面
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -1010,8 +1064,7 @@ namespace HighWayAssemble
|
|
|
|
|
(timeSpan: TimeSpan.FromMinutes(1))
|
|
|
|
|
.SetCheckClearType(clearType: CheckClearType.OnlyReceive);
|
|
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
.Start();//启动
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1019,7 +1072,7 @@ namespace HighWayAssemble
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="socket"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void M_service_Disconnected(TouchSocket.Sockets.SocketClient socket, DisconnectEventArgs e)
|
|
|
|
|
private void M_service_Disconnected(TouchSocket.Sockets.TcpSessionClient socket, ClosedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -1071,7 +1124,7 @@ namespace HighWayAssemble
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="client"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void M_service_Connected(TouchSocket.Sockets.SocketClient client, TouchSocketEventArgs e)
|
|
|
|
|
private void M_service_Connected(TcpSessionClient client, ConnectedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.onLineClient.Add(client);
|
|
|
|
|
}
|
|
|
|
@ -1081,11 +1134,11 @@ namespace HighWayAssemble
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="client">客户端连接信息</param>
|
|
|
|
|
/// <param name="myRequestInfo">接收消息内容</param>
|
|
|
|
|
private async void ParsingMessages(SocketClient client, MyRequestInfo myRequestInfo)
|
|
|
|
|
private async void ParsingMessages(TcpSessionClient client, byte[] myRequestInfo)
|
|
|
|
|
{
|
|
|
|
|
byte[] buffer = new byte[myRequestInfo.Header.Length + myRequestInfo.Body.Length];
|
|
|
|
|
Array.Copy(myRequestInfo.Header, 0, buffer, 0, myRequestInfo.Header.Length);
|
|
|
|
|
Array.Copy(myRequestInfo.Body, 0, buffer, myRequestInfo.Header.Length, myRequestInfo.Body.Length);
|
|
|
|
|
byte[] buffer = new byte[myRequestInfo.Length];
|
|
|
|
|
Array.Copy(myRequestInfo, 0, buffer, 0, myRequestInfo.Length);
|
|
|
|
|
//Array.Copy(myRequestInfo.Body, 0, buffer, myRequestInfo.Header.Length, myRequestInfo.Body.Length);
|
|
|
|
|
|
|
|
|
|
byte[] hbt = new byte[7];
|
|
|
|
|
Array.Copy(buffer, 0, hbt, 0, 7);
|
|
|
|
@ -1265,7 +1318,7 @@ namespace HighWayAssemble
|
|
|
|
|
/// <param name="client">客户端连接信息</param>
|
|
|
|
|
/// <param name="byteBlock">接收消息内容</param>
|
|
|
|
|
/// <param name="iLength">消息长度</param>
|
|
|
|
|
public void SignIn(SocketClient client, byte[] byteBlock, int iLength)
|
|
|
|
|
public void SignIn(TcpSessionClient client, byte[] byteBlock, int iLength)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -1306,7 +1359,7 @@ namespace HighWayAssemble
|
|
|
|
|
SoftInfo.mesSoftList[mesid].AdatperIP = client.IP;
|
|
|
|
|
SoftInfo.mesSoftList[mesid].AdapterPort = client.Port.ToString();
|
|
|
|
|
SoftInfo.mesSoftList[mesid].State = 1;
|
|
|
|
|
client.ResetId(flag.ToString());
|
|
|
|
|
client.ResetIdAsync(flag.ToString());
|
|
|
|
|
App.TriggerHalt(EventSystem.UpdateMesListInfo, SoftInfo.mesSoftList);
|
|
|
|
|
}
|
|
|
|
|
//Sql.InsertSoftState(flag.ToString(), 1);
|
|
|
|
|