I am able to connect the HyperV Socket having Client - Windows & Server - Windows VM
Guid serviceId = Guid.Empty;
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\GuestCommunicationServices\"))
{
if (key != null)
{
foreach (var subKeyName in key.GetSubKeyNames())
{
using var subKey = key.OpenSubKey(subKeyName);
if (subKey == null) continue;
if (subKey.GetValue("ElementName").ToString() == "HV Socket")
{
serviceId = new Guid(subKeyName);
}
}
}
}
endpoint = new HyperVSocketEndPoint(HyperVSocketEndPoint.AF_HYPERV, Guid.Empty, serviceId);
listenSocket = new System.Net.Sockets.Socket(endpoint.AddressFamily, SocketType.Stream, (System.Net.Sockets.ProtocolType)1);
I am not able to connect having the Client - Windows & Server - Linux VM I tried like this as per the MSDN document.
Guid serviceId = new Guid("00000000-ca1d-4946-9e11-3b2ab3ab43c6");
endpoint = new HyperVSocketEndPoint(HyperVSocketEndPoint.AF_HYPERV, Guid.Empty, serviceId);
listenSocket = new System.Net.Sockets.Socket(endpoint.AddressFamily, SocketType.Stream, (System.Net.Sockets.ProtocolType)0);
For connecting to Linux guest (Server) : 00000000-ca1d-4946-9e11-3b2ab3ab43c6 to connect Windows host (client) : guid How do I need to create the CID & port for Client & Server?