如何配置WebSocketSharp客户端使用全局IP地址而不是本地(IPv4)地址?

时间:2019-07-08 13:53:55

标签: c# tcp routing websocket-sharp

我将WebSocketSharp的客户端与SSL一起使用,如下所示:

var uri = $"wss://{_ip}:{_port}/";
websocketSec = new WebSocketSharp.WebSocket(uri);

websocketSec.OnOpen += Websocket_Opened;
websocketSec.OnMessage += WebsocketSec_OnMessage;
websocketSec.OnError += (o, ee) => UpdateResultDisplay($"\r\nWebSocket Error: {ee.Message}");
websocketSec.OnClose += (o, ee) => Websocket_Closed(o, null);

websocketSec.SslConfiguration.ServerCertificateValidationCallback = (s, certificate, chain, sslPolicyErrors) => 
{
    websocketSec.Log.Debug($"Certificate:\n- Issuer: {certificate.Issuer}\n- Subject: {certificate.Subject}");
    return true;
};

websocketSec.Connect();

工作正常。问题是服务器看到我的本地IP地址10.**.**.***。我需要服务器来查看我的全局IP地址。

是否可以通过某种方式配置客户端以使用全局IP地址?

0 个答案:

没有答案