aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Transport
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2022-12-20 13:48:23 +0200
committerRoy <Roy.mail.net@gmail.com>2022-12-20 13:48:23 +0200
commitdbbed260e777d217cc3e897ae31483af183aaabc (patch)
tree40488db6e4a8119054ca78bacf6ad458a00670b5 /Software/Visual_Studio/Tango.Transport
parent2daf438fd6902138b4229e21a8d67b02da778599 (diff)
downloadTango-dbbed260e777d217cc3e897ae31483af183aaabc.tar.gz
Tango-dbbed260e777d217cc3e897ae31483af183aaabc.zip
Implemented FSE/RSM TCP Connection By IP.
Diffstat (limited to 'Software/Visual_Studio/Tango.Transport')
-rw-r--r--Software/Visual_Studio/Tango.Transport/Discovery/TcpValidationInfo.cs14
-rw-r--r--Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs19
-rw-r--r--Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj1
3 files changed, 33 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/TcpValidationInfo.cs b/Software/Visual_Studio/Tango.Transport/Discovery/TcpValidationInfo.cs
new file mode 100644
index 000000000..8dd3aedf0
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Transport/Discovery/TcpValidationInfo.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Transport.Discovery
+{
+ public class TcpValidationInfo
+ {
+ public String SerialNumber { get; set; }
+ public String Guid { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs
index e4ccbe4e9..476537559 100644
--- a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs
+++ b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs
@@ -9,7 +9,9 @@ using System.Text;
using System.Threading.Tasks;
using System.Timers;
using Tango.Core;
+using Tango.Core.ExtensionMethods;
using Tango.PMR.Discovery;
+using Tango.PMR.Integration;
using Tango.Transport.Helpers;
using Tango.Transport.Servers;
@@ -35,6 +37,11 @@ namespace Tango.Transport.Discovery
public DiscoveryMessage CurrentDiscoveryMessage { get; set; }
/// <summary>
+ /// Gets or sets the TCP validation information.
+ /// </summary>
+ public TcpValidationInfo TcpValidationInfo { get; set; }
+
+ /// <summary>
/// Gets or sets the multi-cast group address when using multi-cast discovery method.
/// </summary>
public String MulticastGroupAddress { get; set; }
@@ -59,6 +66,7 @@ namespace Tango.Transport.Discovery
/// </summary>
private UdpDiscoveryService()
{
+ TcpValidationInfo = new TcpValidationInfo();
Interval = TimeSpan.FromSeconds(5);
CurrentDiscoveryMessage = Activator.CreateInstance<DiscoveryMessage>();
}
@@ -73,7 +81,16 @@ namespace Tango.Transport.Discovery
_tcpValidationServer = new TcpServer(Port);
_tcpValidationServer.ClientConnected += (x, e) =>
{
- e.Socket.Dispose();
+ try
+ {
+ var data = GenericMessageSerializer.Serialize(TcpValidationInfo, GenericMessageProtocol.Bson);
+ e.Socket.GetStream().Write(data, 0, data.Length);
+ e.Socket.Dispose();
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "TCP Validation Server Response Error.");
+ }
};
}
diff --git a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj
index c0fac9344..b45138dff 100644
--- a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj
+++ b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj
@@ -113,6 +113,7 @@
<Compile Include="Discovery\IDiscoveryClient.cs" />
<Compile Include="Discovery\IDiscoveryComponent.cs" />
<Compile Include="Discovery\IDiscoveryService.cs" />
+ <Compile Include="Discovery\TcpValidationInfo.cs" />
<Compile Include="Discovery\UdpDiscoveryClient.cs" />
<Compile Include="Discovery\UdpDiscoveryService.cs" />
<Compile Include="Discovery\UsbCommunicationScanner.cs" />