[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: httpapi connect problem



Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>


On Fri, 15 Oct 2004, Ian Patterson wrote:

> SetError() #6: connect(): A remote host refused an attempted connect
>  operation.

This error means that there's no program listening for a connection on the
port number you're trying to connect to.  Quite probably, the web server
isn't listening for connections on the dial-up interface.


> 1. When using unblocked comms, on dial-up connection, we got the 'invalid
> argument' error on the second connect call.
> On the assumption that the error above somehow caused this, it would seem
> that the refused connection seems to destroy the socket or something in the
> socket structure. This would then account for the invalid argument
> situation.

That's possible...  that's why I asked you to try a blocking socket.



> 2. What would cause a remote host to refuse a connection ?. The data sent
> over the dial-up connection is the same as the Internet connection:

Can't be the data you're sending -- you haven't gotten to the point of
sending data.  You have to first connect, THEN send data :)

It's sort of like the way that you can't refuse calls from a telemarketer
(well, at least in the days before caller-id)...  You don't know that it's
a telemarketer until you've answered the phone and talked to the person.

In the HTTPAPI scenario, the connect() is answered with a positive
response when the phone is answered, or a negative response when the phone
is not answered.  The sending of data is the talking over the phone.  If
it's refusing your connection attempt, then there's no way it could know
what data you were planning to send later.

> the only area I can think that may be contributing something here is the
> resolution of the DNS

That's possible, too.  HTTPAPI is resolving the DNS to *something*
however.  It's converting the name 'www.example.com' to some IP address.
I suppose if it's getting the *wrong* IP address, that could cause an
error like this.

Remember, though, every network interface in a computer has a separate IP
address, and programs can elect to listen for connections on every IP
address individually.

So, the dial-up interface has a different IP address than the LAN
interface or the Internet interface. To connect to each one of these, the
web server must be listening to the address that you try to connect to.
That leaves two possibilities:

a) You're attempting to connect to the wrong address. or
b) It's not listening to the adddress you're connecting to.

At any rate the IP address that you're connecting to *IS* responding to
you.  It's sending you back a "connection refused" ICMP packet! There
has to be functional operating system that has TCP/IP configured with that
IP address, and the packets have to be reaching that operating system.

My first guess would be that the web server just isn't configured to
accept requests.  The second guess wouldbe that you're somehow connecting
to the wrong machine.

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------