I would like communicate with a C# UWP Client socket on Windows (host) to a Java server (on Debian VM guest).
- On windows, I use local network. My adress class is 192.168.36.1. My computer local IP is
192.168.36.119
. I use Ethernet Interface. On Debian Virtual (on VMWare), I use NAT network configuration, my adress class is 192.168.73.1. My computer IP is
192.168.73.129
. I use VMware Network Adapter VMnet8 interface.I think the StreamSocket can not get out of the network ethernet interface (.36) to connect to the VMWare network interface in (.73)
The server work well. I can also reach it on Google Chrome easyly and I have tested it with Telnet on Windows.
Here is my test code sample, I try to connect on 192.168.73.129:8082 server socket. It Work very well when java server running on Windows (with my IP windows).
private async void StartClient()
{
try
{
string result = string.Empty;
// Create the StreamSocket and establish a connection to the echo server.
using (var streamSocket = new Windows.Networking.Sockets.StreamSocket())
{
// The server hostname that we will be establishing a connection to. In this example, the server and client are in the same process.
var hostName = new Windows.Networking.HostName("192.168.73.129");
this.clientListBox.Items.Add("client is trying to connect...");
//await streamSocket.ConnectAsync(endPointPair);
await streamSocket.ConnectAsync(hostName, PortNumber);
this.clientListBox.Items.Add("client connected");
// Send a request to the echo server.
string request = "Hello, World!";
using (Stream outputStream = streamSocket.OutputStream.AsStreamForWrite())
{
using (var streamWriter = new StreamWriter(outputStream))
{
await streamWriter.WriteLineAsync(request);
await streamWriter.FlushAsync();
}
}
}
}
catch (Exception ex)
{
Windows.Networking.Sockets.SocketErrorStatus webErrorStatus = Windows.Networking.Sockets.SocketError.GetStatus(ex.GetBaseException().HResult);
this.clientListBox.Items.Add(webErrorStatus.ToString() != "Unknown" ? webErrorStatus.ToString() : ex.Message);
}
}
}
How I can reach the server socket in VMWare Debian ?