IT researcher
IT researcher

Reputation: 3304

Connection is forcefully rejected

Using winsock as shown below we sent information to TCP port 8000. But sometimes we get error like Connection is forcefully rejected(error number 10061) and Connection is aborted due to timeout or other failure(error number 10053) . But in both pc firewall is disabled. so i think port will not be closed due to firewall. So how to troubleshoot these errors.

Dim TempWinClient As New AxMSWinsockLib.AxWinsock

TempWinClient.RemoteHost = PCName
TempWinClient.RemotePort = Port          
TempWinClient.Tag = Message        
TempWinClient.Connect()

Upvotes: 1

Views: 7493

Answers (1)

Daniel W. Elkins
Daniel W. Elkins

Reputation: 316

For one, always call the .Close method on the WinSock control before any .Connect. I don't know what AxMSWinsockLib is, wrapper for the Winsock APIs?

Anyway, as to your question:

Firewalls aren't the only thing in the way. Ports need to be forwarded on the listening server's router; in this case, port 8000.

So on the server that you're attempting to connect to:

  1. See if it is hooked up to a router. You need its "Default Gateway".
  2. Open up a command prompt and type "ipconfig" without the quotes. Find the correct adapter, look at the IP address (usually 192.168.1.x) and then find the Default Gateway. Keep note of the IP address though!
  3. The Default Gateway is the IP address of the router which you will connect to through a web browser like Internet Explorer (yuck), Google Chrome, Firefox, etc.
  4. Open up your web browser of choice and type in: htp://192.168.0.1 (http, not htp) where the 192.168.0.1 is the Default Gateway.
  5. You will be prompted for a username and password. Do a search on your router's model for the default password, but usually admin/admin, administrator/admin, or something will work.
  6. Go through the menus and find something called Port Forwarding. It's different for each router, you may have to Google search for "[router model here] port forwarding" to get instructions.
  7. Once on the port forwarding page, enter the IP address you should have taken note of earlier. This will tell the router to forward packets on port 8000 to the correct computer.
  8. Enter the port number (8000) and apply the settings.

Then try to reconnect.

Upvotes: 1

Related Questions