C# console app web socket - clients not able to connect - c#

I created a C# console app web socket. It works and handles everything on my local machine, but now I have uploaded it on a real server so I can connect to it anytime.
But when I connect to the server endpoint, no connection is being made. I get this error:
WebSocket connection to 'ws:// ... :8083/' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
I have opened the port using:
netsh firewall add portopening TCP 8083 "NetBIOS TCP Port 8083"
and I've also tested to see if it's listening, and it is:
netstat -na | find "8083"
I repeat that the console app web socket was working on my local machine, but not working on the real server.
Any thoughts on this? Thank you!

Related

Can UWP apps communicate via network?

Can UWP apps communicate via network?
I tried running the Sockets Example from MSDN. The communication works, but only within the same app. If I try to connect to the socket from another app, the socket does not seem to receive any data.
I set the capabilities properly (Internet (Client & Server), Internet (Client) and Private Networks (Client & Server)).
I tried copying the same client code to another UWP app, but it fails to communicate to the server app (however, it hangs, the connection is not refused if the server app is running). I tried communicating with the socket from a .NET Console application. This also failed.
I viewed the related post (Connecting two local uwp Apps on same machine) and made sure not to run the server on localhost, but rather to run it on a local address as suggested in How do I find the local IP address on a Win 10 UWP project.
However, this did not help. The socket is only reachable from within the server UWP app.
When I run netstat -a, I can see the app listening on 0.0.0.0:1337. I also tried on 127.0.0.1, localhost and my LAN IP. I tried disabling Windows Firewall, but it did not help.
Any suggestions?
Evidently, the answer is no. Packets are prevented from reaching the socket if the UWP server is on the same machine as the client.
Socket Communication on UWP(Universial Windows Platporm)

SOAP Service "A socket operation was attempted to an unreachable host"

I'm using C# WinForms app to receive data from the remote SOAP service and it's working great on every testing machine with VPN connected/disconnected.
But there is an exception on one PC after connecting it to VPN network:
System.Net.WebException: Unable to connect to the remote server --->
System.Net.Sockets.SocketException: A socket operation was attempted
to an unreachable host XX.XX.XX.XX:443
If it's not connected to VPN its receiving data from the service as intended.
What's wrong there? I've tried to disable AVG and firewall but no success.
Is there port blocked after VPN connected or maybe VPN using the same port?... I really don't know what to do :)
netstat doesn't show 433 port in use, btw
I guess this is port issue but who knows...

Listening for SMTP works when server and request is local but if doing the request from a remote server it fails

I am working on a project where I am making my own SMTP server. This is pretty much working but there is a bit of a problem.
When I run my SMTP server on my development machine and have a php script to send the email or telnet from my local computer to the local smtp server it works fine and my program receives the SMTP messages and I send the relevant responses.
I am then copying the program on to a server and running my smtp server and when I telnet from the server to the local smtp server i.e. telnet localhost 25 it works.
If I then try and connect to my smtp server through a remote PC on the same network and attempt to telnet to it I get Connecting to 192.168.1.74 (this is the address of the server)...could not open connection to the host, on port 25: connect failed and if I run the php script http://192.168.1.74/send-mail.php it fails.
On the smtp server code when I bind the socket I have tried binding to 127.0.0.1 and 192.168.1.74 on port 25 but it makes no difference.
Why would this not be working from a remote PC making the connection to the server but locally it works fine.
Thanks for any help you can provide.
A couple stabs in the dark here, but:
Does the server have a firewall running? If so, have you made the appropriate exceptions for port 25?
Is the remote PC really on the same network (i.e. same subnet)? If you've got a router in between you'll have to forward the port appropriately.
Found out what the problem was, I was being dumb, when I set the network card to be static I forgot to add the default gateway. Now that I have done that it is working now as expected.
Thanks everyone for your help and suggestions.

Error Code 10060 in a Winforms application using Sockets (TCP)

I have a server program and a client program. I built it based from the appliation from this tutorial. The thing is, it works (connects successfully and communicates) when I run both the program on the same computer. But when I tried running the client app in a different computer from where the server runs and connect it to the server app, this exception happens:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 169.254.212.31:1986
I made sure that the client app will connect to the IP Address that the Server App listens to. I am running my application in a LAN. What should I do to resolve this problem?
UPDATE:
I'm sorry, forgot to put the link of the tutorial I was talking about. Here it is.
Solved the problem by opening a port (in my case, Port 1986).
I followed this guide:
How to open a port in windows 7 firewall

Socket programming issue in Silverlight

I have a silverlight application that is communicating with a server hosted in cloud. The application works properly when the server is listening on localhost, but when I make it listen on the server port and make my client access the socket, I get the error "Access denied"
Digging deep, I also found the error in ScopeId resolution
Error Code: 10045
e.RemoteEndPoint. Address.ScopeId threw an exception
The attempted operation is not supported for the type of object referenced.
at System.Net.IPAddress.get_ScopeId()
Thank You
"In Silverlight version 4 for a connection request using System.Net.Sockets, an application can choose instead to retrieve the policy file via the HTTP protocol on TCP port 80 instead of the custom TCP protocol on port 943. This allows HTTP servers that are already running HTTP services to authorize socket connections from Silverlight applications without having to deploy a new TCP service on the machine and open a port through a firewall for port 943."
http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx

Categories