Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WSAECONNREFUSED problem

Posted on 2008-06-09
6
Medium Priority
?
1,134 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 2000 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

604 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