|
@@ -6,6 +6,10 @@ using Sers.ServiceCenter.Entity;
|
|
|
using Vit.Core.Util.ComponentModel.Api;
|
|
|
using Vit.Core.Util.ComponentModel.Data;
|
|
|
using Vit.Core.Util.ComponentModel.Model;
|
|
|
+using Vit.Extensions;
|
|
|
+using System.Net.WebSockets;
|
|
|
+using System.Net;
|
|
|
+using System;
|
|
|
|
|
|
namespace Sers.ServiceCenter.Controllers
|
|
|
{
|
|
@@ -21,15 +25,47 @@ namespace Sers.ServiceCenter.Controllers
|
|
|
[SsName("注册站点")]
|
|
|
[SsCallerSource(ECallerSource.Internal)]
|
|
|
public ApiReturn Regist(ServiceStation serviceStation)
|
|
|
- {
|
|
|
+ {
|
|
|
serviceStation.connection = CommunicationManageServer.CurConn;
|
|
|
|
|
|
- if(serviceStation.connection!=null)
|
|
|
+ if (serviceStation.connection != null)
|
|
|
serviceStation.connection.connTag = serviceStation?.serviceStationInfo?.serviceStationName;
|
|
|
|
|
|
+ #region (x.2)获取客户端ip地址
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (serviceStation.connection != null)
|
|
|
+ {
|
|
|
+ var deliveryConn = serviceStation.connection.GetDeliveryConn();
|
|
|
+ global::System.Net.Sockets.Socket socket = null;
|
|
|
+
|
|
|
+ if (deliveryConn is Sers.CL.Socket.ThreadWait.DeliveryConnection conn_threadWait)
|
|
|
+ {
|
|
|
+ socket = conn_threadWait.socket;
|
|
|
+ }
|
|
|
+ else if (deliveryConn is Sers.CL.Socket.Iocp.Base.DeliveryConnection_Base conn_Iocp)
|
|
|
+ {
|
|
|
+ socket = conn_Iocp.socket;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (socket != null)
|
|
|
+ {
|
|
|
+ IPEndPoint clientPoint = (IPEndPoint)socket.RemoteEndPoint;
|
|
|
+ string clientIp = clientPoint.Address.ToString();
|
|
|
+ serviceStation.connectionIp = clientIp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (System.Exception)
|
|
|
+ {
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//注册站点
|
|
|
ServiceCenter.Instance.apiCenterService.ServiceStation_Regist(serviceStation);
|
|
|
- return true;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
|