On 16/08/2024 08:54, Jeremy Laidman wrote:
Hi
Can anyone tell me if there's a way to have XymonPSClient bind to a specific IP address (or NIC) when connecting to the Xymon server? I'm having the client installed onto some dual-homed hosts, where the NIC with the default route is used for web services and a secondary NIC is used for management traffic. I need the Xymon client to use the management NIC IP address so that it routes via the management traffic path. I'd rather not add a static route onto the host.
I thik this is the critical line:
https://github.com/svn2github/xymon/blob/master/sandbox/WinPSClient/xymonsen...
Checking the docs for TcpClient,
https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.tcpclient.-c...)
"If you create a TcpClient using any other constructor, the underlying service provider will assign the most appropriate local IP address and port number."
(you might have to ask MS how they decide what is "most appropriate" .. !)
Quoting from https://stackoverflow.com/a/2016029, calling the constructor with arguments like
TcpClient c=new TcpClient(new IPEndPoint(IPAddress.Parse("192.168.1.1"), 0);
would force the TcpClient to use the specified local address.
That looks to me like the answer is probably "not without a bunch of modifications"
Adam