Board index » delphi » Indy "Connect" method fails with TidSMTP

Indy "Connect" method fails with TidSMTP

If user clicks "Cancel" on dial-up connection initiated by TidSMTP.Connect,
subsequent calls to Connect fail...until you exit the app and try again
(this occurs in the Indy MailDemo as well - gives a socket error).

Can anyone tell me what has to happen to "clean up" the failed connect???

--
Brent Rose
br...@voyager.co.nz

 

Re:Indy "Connect" method fails with TidSMTP


Quote
> Can anyone tell me what has to happen to "clean up" the failed
> connect???

What version of Indy are you using ??

Good luck,
Stephane

Re:Indy "Connect" method fails with TidSMTP


Oops - ver 8.022. Will try 9 forthwith! Thanks for the pointer.

Brent Rose
br...@voyager.co.nz

Re:Indy "Connect" method fails with TidSMTP


OK - same problem using Ver 9.00.02.

Once a dial-up is "Cancelled", it is not possible to re-dial...

The MailDemo app reports "Socket Error #11001"...

--
Brent Rose
br...@voyager.co.nz

Re:Indy "Connect" method fails with TidSMTP


"Brent Rose" <br...@voyager.co.nz> wrote in news:3bfeeef3_2@dnews:

Quote
> OK - same problem using Ver 9.00.02.

> Once a dial-up is "Cancelled", it is not possible to re-dial...

> The MailDemo app reports "Socket Error #11001"...

We've looked into this a bunch of times, and everytime it points to a bug in the DUN and stack.

--
Chad Z. Hower (Kudzu) - http://www.pbe.com/Kudzu/
Current Location: St. Petersburg, Russia
      "Programming is an art form that fights back"

IntraWeb - True RAD Development for the web
http://www.pbe.com/IntraWeb

Re:Indy "Connect" method fails with TidSMTP


"Brent Rose" <br...@voyager.co.nz> schrieb im Newsbeitrag
news:3bfeeef3_2@dnews...

Quote
> OK - same problem using Ver 9.00.02.

> Once a dial-up is "Cancelled", it is not possible to re-dial...

> The MailDemo app reports "Socket Error #11001"...

not a sockets problem, you have to use ras api:

1) switch off automatic connecting in internet propertys.
2) add a ras dial component to your application and do
dial in and hang up as you wish.
You will find free at:
http://www.overbyte.be/
http://www.magsys.co.uk/delphi/index.htm
http://www.argosoft.com/
or have a look to http://www.torry.net/

Ernst Gerlach
ernst.gerl...@epost.de
http://www.gerlach-mtl.de
--- use plain text only in email ---

Re:Indy "Connect" method fails with TidSMTP


Thanks Ernst.

The difficulty I'm having with manual RAS dial-up is how to manage users who
have LAN connections... I need to detect the LAN option and use that by
preference...

Will check out your URLs...

--
Brent Rose
br...@voyager.co.nz

Re:Indy "Connect" method fails with TidSMTP


Quote
> The difficulty I'm having with manual RAS dial-up is how to manage
> users who have LAN connections... I need to detect the LAN option and
> use that by preference...

How about: "Ask the user ?"

All you can tell is: if there is not NIC on the machine configured for
TCP/IP (i.e. you get only "0.0.0.0" when retreiving the list of local IP)
the you must use DUN. Anything beyond that is not good enough so your best
option is to ask.

Good luck,
Stephane

Re:Indy "Connect" method fails with TidSMTP


"Ask the user?" ????????? I can't see how that would be possible or of any
practical use if there are many and varied users...

Best answer (from Steve Moss - thanks Steve) seems to be using API
InternetGetConnectedState(). This is actually very simple: it returns the
flag INTERNET_CONNECTION_LAN when an active LAN connection is available. If
it is not available, then I can simply resort to RAS connections instead...

--
Brent Rose
br...@voyager.co.nz

Re:Indy "Connect" method fails with TidSMTP


Quote
> "Ask the user?" ????????? I can't see how that would be possible or of
> any practical use if there are many and varied users...

Well, simple: when installing your software, ask "How do you connect to
Internet ? 1/ Using a modem 2/ Using the local network"

Quote
> Best answer (from Steve Moss - thanks Steve) seems to be using API
> InternetGetConnectedState(). This is actually very simple: it returns
> the flag INTERNET_CONNECTION_LAN when an active LAN connection is
> available. If it is not available, then I can simply resort to RAS
> connections instead...

So, what happend if the user is connected to a LAN but uses a modem to
connect to the net ? What happend if the user uses a VPN that stands as a
network adapter ? In both case, you'll be using the wrong device to connect.

Good luck,
Stephane

Re:Indy "Connect" method fails with TidSMTP


Quote
> Well, simple: when installing your software, ask "How do you connect to
> Internet ? 1/ Using a modem 2/ Using the local network"

Ah, but - I don't know the users, I don't install the software, and most
importantly what am I going to do with the answer to this question
anyway??????? Have a setup switch in the app to direct it to one or the
other option?? Have 2 versions of the app hard-coded to the two different
situations??? And what happens when the answer is sometimes 1/ and sometimes
2/?????

This seems quite unnecessary (and inadequate) when the app can simply
dynamically ask the question itself, and behave accordingly without me being
involved at all!!

Quote
> So, what happend if the user is connected to a LAN but uses a modem to
> connect to the net ?

If the user is on a LAN but there is no LAN internet connection, the
INTERNET_CONNECTION_LAN flag is NOT returned - so the app can safely resort
to RAS dial up. I'm going to assume that if there IS a LAN connection
available, the user would have no reason to want to use a modem, or if they
do, they can unplug from the LAN and happily do so!

Quote
>What happend if the user uses a VPN that stands as a network adapter ?

I don't understand enough about such a setup or the point you're trying to
make to answer this. I guess I'll have to look at that issue if or when it
arises!

Thanks for your responses.

--
Brent Rose
br...@voyager.co.nz

Re:Indy "Connect" method fails with TidSMTP


On 28 Nov 2001, "Brent Rose" <br...@voyager.co.nz> wrote in
news:3c0538b9_2@dnews:

Quote
>> Well, simple: when installing your software, ask "How do you connect
>> to Internet ? 1/ Using a modem 2/ Using the local network"

> Ah, but - I don't know the users, I don't install the software, and
> most importantly what am I going to do with the answer to this question
> anyway???????

Hum... I wasn't expecting you to go to each user and ask him, you know: you
can ask it during the program installation or the first time the program
runs. Afterward, you know if you must use DUN or if you can use the NIC.

Quote
>Have a setup switch in the app to direct it to one or the
> other option??

Exactly.

Quote
>Have 2 versions of the app hard-coded to the two
> different situations??? And what happens when the answer is sometimes
> 1/ and sometimes 2/?????

How about an option page that will allow you to switch ? And if you're
wirried about mobile users (who frequently switch from using a modem and
using the LAN), you can create a simple mechanism to allow them to switch
between the two (like a command-line option in your program or, better, a
simple, command-line conrol program that can easily be included ine a logon
script)

Quote
> This seems quite unnecessary (and inadequate) when the app can simply
> dynamically ask the question itself, and behave accordingly without me
> being involved at all!!

But my point is: the app can make the wrong decision! And in that case, your
user won't be able to use it!

Quote
>> So, what happend if the user is connected to a LAN but uses a modem to
>> connect to the net ?

> If the user is on a LAN but there is no LAN internet connection, the
> INTERNET_CONNECTION_LAN flag is NOT returned - so the app can safely
> resort to RAS dial up.

Wrong. You can easily be connected to an IP lan and still have no net
connection there. You'll get INTERNET_CONNECTION_LAN as well.

Quote
> I'm going to assume that if there IS a LAN
> connection available, the user would have no reason to want to use a
> modem, or if they do, they can unplug from the LAN and happily do so!

In my book, unpluging the network cable is more troublesom than swicthing an
application flag. And what if I want to USE that LAN (to connect to my file
server, perhaps) while I use your application ?

Quote
>>What happend if the user uses a VPN that stands as a network adapter ?

> I don't understand enough about such a setup or the point you're trying
> to make to answer this. I guess I'll have to look at that issue if or
> when it arises!

I mean that some setup can have device drivers posing as NICs connected to
IP network while you could have no proper internet connection.

It is really impossible to know how a user connects to Internet. You can try
to guess and, quite often, get it right, but you'll still have a lot of
potential users that will not be able to use your program if you don't have
a manual swicth. It is a good thing to use your guess to choose the default,
but you should alway let the user have the final word.

Good luck,
Stephane

Quote
> Thanks for your responses.

> --
> Brent Rose
> br...@voyager.co.nz

Re:Indy "Connect" method fails with TidSMTP


Thanks for your comments Stephane. Guess nothing's quite as simple as one
might hope!

Quote
> Wrong. You can easily be connected to an IP lan and still have no net
> connection there. You'll get INTERNET_CONNECTION_LAN as well.

I thought I had tested INTERNET_CONNECTION_LAN behaviour on a LAN with no
connection and it was NOT returned if there was no connection...but I might
have got that wrong....

Rather than ONLY have a "LAN" option in a combo-box if
INTERNET_CONNECTION_LAN is returned, I could include all RAS/DUN modem
options regardless - then if the LAN option is NOT really available, they
can resort to a RAS option....

Certainly, I still can't grasp why I need to do any more than this - setup
options would just confuse the user. Indeed, having setup options still
implies that I can target the option in question (if not actually detect
it) - so I should be able to just any other options (whatever they are??) to
the same combo-box....

Anyway - the app is now working perfectly in this manner for all the users
who have LANs....

So... sleeping dogs... the issue may well come back and bite me later on!

Thanks again.
--
Brent Rose
br...@voyager.co.nz

Other Threads