Solved

WSAECONNREFUSED problem

Posted on 2008-06-09
6
1,131 Views
Last Modified: 2013-12-14
I am using Winsock inside two programs. In one program, the code to startup the connection is working perfectly. This program is a simly command line where all it does is perform the connection, and send and recieve a little data, all this works fine.

I have another program. It's a windows API application, alot going on. I implement that exact same code, and when the connect method gets call, I'm not getting the socket back but an error. WSAECONNREFUSED. This is the error you get when the service is not at that address on that port. But it is.

I even know that the connection is somewhat happening. I am the developer of the server program as well. I can see the connection get made on the server.

Why might this be happening in the windows program, but no the command line?

Thanks!
Matthew
0
Comment
Question by:mattososky
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 21745503
>> I even know that the connection is somewhat happening.

What do you mean by somewhat ?


>> WSAECONNREFUSED

As you said, this means that either there's no service listening at the targeted port. Buut it could also be caused by a firewall for example.
0
 

Author Comment

by:mattososky
ID: 21745777
The server is registering the client connection, it's just the stream seems to close before and data is sent or recieved.

The service is definately there and accessable. As I already said, another program using the same code and variables is hitting the service normally
0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 500 total points
ID: 21745907
>> The server is registering the client connection

So, the accept call returns successfully ?


>> As I already said, another program using the same code and variables is hitting the service normally

Apparently there is some difference between the two tests you performed ... I'm just trying to find it :) Try to go over the complete test, and note any differences, however small, between the two.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Closing Comment

by:mattososky
ID: 31465467
Yes, I rearranged the code to be an exact duplicate, even though it was logicall the same, and now it works. I'm truely stumped as to why. It is logically 100%, the different being a few variable being global instead of local to the functions. But the scope is handled correcty as well is implementation. Also serveral calls on those vairiables leading up to the point of failure worked fine. I'm not sure why, but it's working....
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 21746181
>> the different being a few variable being global instead of local to the functions.

Is the application multi-threaded ?


>> I'm not sure why, but it's working....

That's good then :)
0
 

Author Comment

by:mattososky
ID: 21746907
The client protion where I saw the problem is single threaded.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question