feat: add logger to udpclient
This commit is contained in:
parent
ea7c2d425a
commit
e3826f0ff6
|
@ -809,6 +809,10 @@ public class BsdlParserController : ControllerBase
|
||||||
{
|
{
|
||||||
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// [TODO:description]
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>[TODO:return]</returns>
|
||||||
[EnableCors("Development")]
|
[EnableCors("Development")]
|
||||||
[HttpGet("GetBoundaryLogicalPorts")]
|
[HttpGet("GetBoundaryLogicalPorts")]
|
||||||
public IResult GetBoundaryLogicalPorts()
|
public IResult GetBoundaryLogicalPorts()
|
||||||
|
|
|
@ -845,6 +845,11 @@ public class Jtag
|
||||||
return portStatus;
|
return portStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// [TODO:description]
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">[TODO:parameter]</param>
|
||||||
|
/// <returns>[TODO:return]</returns>
|
||||||
public async ValueTask<Result<bool>> SetSpeed(UInt32 speed)
|
public async ValueTask<Result<bool>> SetSpeed(UInt32 speed)
|
||||||
{
|
{
|
||||||
// Clear Data
|
// Clear Data
|
||||||
|
|
|
@ -9,6 +9,8 @@ using WebProtocol;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UDPClientPool
|
public class UDPClientPool
|
||||||
{
|
{
|
||||||
|
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
private static IPAddress localhost = IPAddress.Parse("127.0.0.1");
|
private static IPAddress localhost = IPAddress.Parse("127.0.0.1");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -58,6 +60,9 @@ public class UDPClientPool
|
||||||
var sendLen = socket.SendTo(buf, endPoint);
|
var sendLen = socket.SendTo(buf, endPoint);
|
||||||
socket.Close();
|
socket.Close();
|
||||||
|
|
||||||
|
logger.Debug($"UDP socket send bytes to device {endPoint.Address.ToString()}:{endPoint.Port.ToString()}:");
|
||||||
|
logger.Debug($" Original Data: {BitConverter.ToString(buf).Replace("-", " ")}");
|
||||||
|
|
||||||
if (sendLen == buf.Length) { return true; }
|
if (sendLen == buf.Length) { return true; }
|
||||||
else { return false; }
|
else { return false; }
|
||||||
}
|
}
|
||||||
|
@ -86,6 +91,10 @@ public class UDPClientPool
|
||||||
var sendLen = socket.SendTo(sendBytes, endPoint);
|
var sendLen = socket.SendTo(sendBytes, endPoint);
|
||||||
socket.Close();
|
socket.Close();
|
||||||
|
|
||||||
|
logger.Debug($"UDP socket send address package to device {endPoint.Address.ToString()}:{endPoint.Port.ToString()}:");
|
||||||
|
logger.Debug($" Original Data: {BitConverter.ToString(pkg.ToBytes()).Replace("-", " ")}");
|
||||||
|
logger.Debug($" Decoded Data: {pkg.ToString()}");
|
||||||
|
|
||||||
if (sendLen == sendBytes.Length) { return true; }
|
if (sendLen == sendBytes.Length) { return true; }
|
||||||
else { return false; }
|
else { return false; }
|
||||||
}
|
}
|
||||||
|
@ -115,6 +124,9 @@ public class UDPClientPool
|
||||||
var sendLen = socket.SendTo(sendBytes, endPoint);
|
var sendLen = socket.SendTo(sendBytes, endPoint);
|
||||||
socket.Close();
|
socket.Close();
|
||||||
|
|
||||||
|
logger.Debug($"UDP socket send data package to device {endPoint.Address.ToString()}:{endPoint.Port.ToString()}:");
|
||||||
|
logger.Debug($" Original Data: {BitConverter.ToString(pkg.ToBytes()).Replace("-", " ")}");
|
||||||
|
|
||||||
if (sendLen == sendBytes.Length) { return true; }
|
if (sendLen == sendBytes.Length) { return true; }
|
||||||
else { return false; }
|
else { return false; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue