Cannot connect to WebSocket Server. No idea why - c#

I'm using the code from this article just to try and get something up and running. However, I cannot seem to connect to the web sockets server once it's running.
I have tried forwarding both ports 8080 and 8181, ensuring that they are forwarded using canyouseeme, allowing the ports under my firewall, completely disabling my firewall, trying and forwarding different ports, etc.
Nothing has worked so far. Both the HTML browser page and console server application run just fine with no errors but I keep getting this error message when I try to connect through the HTML page in my browser:
Connecting to ws://localhost:8181/chat ...
Socket closed!
I have never used WebSockets before so I'm not sure if I'm missing something like if I need to install some framework, run some daemon, or what. I'm running Windows 7 64 Bit and using Visual Studio to run the solution. Not sure how to get this to work. Anyone have any ideas?

The server mentioned in that article is likely using the older Hixie protocol. If you are running a recent version of Chrome or Firefox then you are using the newer HyBi/IETF protocol. The article was written in Jun 2010 before the newer protocol was standardized and adopted.
Update:
Fleck looks like a descendant of the code in that article (via Nugget) that supports the old and new protocol variants.

Related

Android as host not working, Unity LLAPI

so i'll try my best to post this properly. I asked this before on unity forums, but i didn't found an answer yet, here is the link if you want it.
I have a working demo of a Server side broadcasting and Client reciving the message parsing and using the info to connect to the server.
NetworkTransport.Init();
NetworkTransport.AddHost(defaultTopology, PORT)
NetworkTransport.StartBroadcastDiscovery(id,broadcastport,..,..)
NetworkTransport.Receive(..,..)
NetworkTransport.Connect(..,..)
etc. I can go on further detail on code if you want it, but as far as its working on PC fine I think the code is fine.
When I try the same with PC as server, Android as Client, if the Android device act as a client, he don't recieve the broadcast from the server but i can connect manually(i know the IP of my local machine) and i can send and recieve messages.(This is okay except for the broadcast problem that would be nice to fix)
If the Android act as Server and PC client, the PC recieves the broadcast but can't connect to the Android neither automatically nor manually.
I tested with 2 Androids an the results are bad too.
The client didn't recieve the broadcast and if I try the manual connection the server didn't recieve the connect event. The main goal is using 2 androids.
I searched for problems with the Network and Unity but i only found some people talking about the Android Manifest but not saying exactly what to do about. If you can point me to the correct direction with this i would apreciate.
Also maybe the Android 6 permissions have something to do with that?
I personally think that the android cant recieve nothing until is conected, so when he acts as Client he don't recieve the broadcast but can connect and then works fine, but as a Server he cant recieve the connection.
Maybe has something to do on Android Ports? I usually use 25001.
Using Unity 5.3.5f1
Thanks and sorry for my poor english.
Edit:
I changed to Unity 5.4 to check about Android 6 permisions and isn't working too.
You have a demo here if you want to try
Is an isolation from another project so maybe you find comented delegates and other stuff.
Yes, it is indeed the Android Manifest. I see no other reason why this is not working. The method permission query is handled changed on Android 6.0. You have to download Unity 5.4 to fix this problem.

C# FtpWebRequest with SSL to Ubuntu VSFTPD

I have spent hours trying to get the .NET FtpWebRequest library to communicate with my Ubuntu 16.04 FTP server using vsftpd over SSL.
No matter what I try, I always end up with the exception "A call to SSPI failed. The message received was unexpected or badly formatted."
I have tried generating client and server certificates, installing them in windows, loading them with the X509 class in .NET, toggling various client and server side options. No matter what I do, it's always the same error. I believe this has something to do with my certificate not being verified by an authority. Here are my basic questions:
1) Can .NET just ACCEPT a suspicious certificate?! Installing it 30 different ways seems to have no affect?
2) What does "a call to SSPI failed" really mean? I've read conflicting answers. I have no problem connecting with TLS/SSL via FileZilla, but .NET 4.5 just won't have it.
3) Can someone give the minimum amount of steps to have a Windows 7 client using the .NET framework connect to a Linux server using vsftpd over SSL? I strongly believe the problem lies in my Windows/.NET settings since FileZilla on my Windows machine has no problem connecting.
Thank you in advance.
Insert the line below in your vsftpd.conf:
ssl_ciphers=AES128-SHA

Silverlight can't download clientaccesspolice.xml without running Fiddler

My project consists of 2 parts Silverlight and WindowsForms.
WindowsForm returns data at localhost:8081 or another port.
Data can easily see through the browser by typing the address, with the parameters on all computers.
If Silverlight is enabled on the local server everything works fine, the problems start when you run it on an external server.
On my computer everything works fine, but on some computers, an error is returned "Async_ExceptionOccurred".
Following the network turned out that Silverlight can't get clinetaccesspolice.xml, request has been sent but nothing happens, no error is returned. Of course directly in the browser can open the file.
After turned Fiddler bug disappears on some computers.
It follows that clinetaccesspolice and cross-domain set correctly. Something is blocking communication between Silverlight from external domain and localhost.
I found a solution. Maybe it's not too professional, but solves the problem.
Fiddler share its own engine for developers. Use it in the program used on PC. The engine will automatically change the proxy settings so the client does not need to know anything ;)
Fiddler core
// Call Startup to tell FiddlerCore to begin listening on the specified port,
// and optionally register as the system proxy and optionally decrypt HTTPS traffic.
Fiddler.FiddlerApplication.Startup(8877, true, true);
// Call Shutdown to tell FiddlerCore to stop listening on the specified port, and
// unregister as the system proxy if attached.
Fiddler.FiddlerApplication.Shutdown();

.Net Remoting not working in Windows 7

We have a server application (developed using .Net 1.1, C#) which listen the port 8086 and the client application, before starting will handshake with this server using remoting.
The application is working fine in almost all environments - Windows 2000/2003/2008/XP/Vista.
Now we are facing an issue with Windows 7.
When we are staring the server, it’s opening the port and will be listening to clients, but when try to send a request from a client who is running in other OS, it gives a message that server is not running.
We disabled the proxy, gave the exceptions for proxy but all went in vain. On further analysis we found that the system is having multiple connectivity (LAN, Bluetooth &WIFI).
When we checked the TCP port using netstat –a it showed the Local Address as 0.0.0.0:8086. So we disabled/removed the Bluetooth & WiFi option and tried again then also netstat is showing LocalAddress 0.0.0.0:8086.
How to go ahead in this situation?
Thanks in advance.
Do a network capture using Microsoft Network Monitor or Wireshark to better understand the underlying TCP/IP packets. That can show what's up easily.

simulating slow internet connection on localhost

iam using c#,asp.net and iis, i want to simulate slow internet connection on my pc for testing my app.
is it possible i can control bandwidth of iis.
please dont suggest
System.Threading.Thread.Sleep(someDuration);
in c# file.
You can run Fiddler and use its connection throttling to simulate a slow connection.
Note that you'll need to browse to your machine name, not localhost. (localhost. should also work)
Fiddler will do this for you.
You could find or create a proxy that provides file-configurable or UI-modifyable speed controls. The proxy would get the request from the client, make the request to the server, receive the response, then s-l-o-w-l-y send the response to the client. (It would probaly use some sort of Thread.Sleep(x) in between sending each byte of the response to the client.)
After searching a little on the internet, I found no freeware/FOSS on win32 that does the job for arbitrary ports.
I have a server under tests that listens on port 13000 and a client under test that has a configurable sending port. Many tools, designed for web only, make a throttling tunnel from port 80 to something configurable, but my server will never listen on port 80..
Anyone knows something like unix 'tc' command?
This isn't linked to C#, but I would suggest to slow down the system network (or the vm network ..) instead, it should be much easier to play around.
In linux, we can use tc.
sudo tc qdisc add dev wlp3s0 root netem delay 500ms
To turn it off:
sudo tc qdisc del dev wlp3s0 root netem
Source: http://jvns.ca/blog/2017/04/01/slow-down-your-internet-with-tc/
https://linux.die.net/man/8/tc

Categories

Resources