WebSocket4Net icon indicating copy to clipboard operation
WebSocket4Net copied to clipboard

Not able to use a host name to connect to web socket

Open jphoc13 opened this issue 7 years ago • 3 comments

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.

jphoc13 avatar Mar 13 '17 20:03 jphoc13

Do you have stacktrace of this exception.

kerryjiang avatar May 20 '17 01:05 kerryjiang

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).

zplzk2 avatar Jul 03 '17 03:07 zplzk2

I was able to connect with a hostname for iOS, but still not able to do so in Android.

jphoc13 avatar Jul 03 '17 17:07 jphoc13