WebSocket4Net
WebSocket4Net copied to clipboard
Not able to use a host name to connect to web socket
Cannot access disposed object is the error I am receiving. For some reason the socket doesn't open and so it gets garbage collected.
I am able to use the host machine IPaddress but in trying to use the hostname I am running into issues.
sIpAddress = "host.hostname.com";
sPort = Convert.ToInt32("11003");
IPHostEntry ip = Dns.GetHostEntry(sIpAddress);
vWebsocket= new WebSocket("ws://" + ip.HostName + ":" + sPort + "/");
Note: I am trying to use the web socket in an iOS app on Xamarin Studio. I am able to connect from the same machine I am debugging this app on. Not sure if this matters.
Do you have stacktrace of this exception.
I met similar issue with mono 4.6.2.7. My server is behide ELB and that seems to matter. In this case, only IP can work. Both IP and host name work when connecting to a server without ELB.
Downgrading to mono 4.4.2.11 can fix it (working with host name and ELB).
I was able to connect with a hostname for iOS, but still not able to do so in Android.