Solved

WSAECONNREFUSED problem

Posted on 2008-06-09
6
1,123 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now