Solved

WSAECONNREFUSED problem

Posted on 2008-06-09
6
1,122 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

762 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

24 Experts available now in Live!

Get 1:1 Help Now