BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using TIdSMTP with SOCKS

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Joao Lira
Guest





PostPosted: Tue Apr 27, 2004 12:26 am    Post subject: Using TIdSMTP with SOCKS Reply with quote




Hello,


I couldn´t find any (practical) information on how to use the TIdSMTP component, for example, with SOCKS. Suppose I drop a TIdSMTP, a TIdIOHandlerSocket and a TIdSocksInfo components in a form. After the right assigns to the 'IOHandler' and 'SocksInfo' properties, respectively, how make the things work? I´m confused about what method should be used in a case like this. 'TIdSocksInfo.MakeSocksConnection', 'TIdSMTP.Connect', nothing seems to work after setting the properties (I have a SOCKS server locally to play with). In short: in a scenary like this what are the steps to be followed?

Thanks for any help.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Apr 27, 2004 12:31 am    Post subject: Re: Using TIdSMTP with SOCKS Reply with quote




"Joao Lira" <joaolira (AT) mandic (DOT) com.br> wrote


Quote:
I´m confused about what method should be used in a case like this.

You use TIdSMTP exactly as you normally would if you weren't enabling SOCKS
at all. All of the SOCKS handling is done internally for you.

Quote:
TIdSocksInfo.MakeSocksConnection

You never call that method yourself. It is called automatically during
Connect().

Quote:
TIdSMTP.Connect

That is all you call yourself.

Quote:
nothing seems to work after setting the properties

Did you set up the proerties correctly to begin with? Did you set the
TIdSocksInfo's Host, Port, Version, Authentication, Username and Password
properties?


Gambit



Back to top
Joao Lira
Guest





PostPosted: Tue Apr 27, 2004 3:33 pm    Post subject: Re: Using TIdSMTP with SOCKS Reply with quote




Hello Gambit,

">You use TIdSMTP exactly as you normally would if you weren't enabling SOCKS
Quote:
at all. All of the SOCKS handling is done internally for you.

That´s amazing! Never thought it could be that simple!

Quote:
TIdSocksInfo.MakeSocksConnection

You never call that method yourself. It is called automatically during
Connect().

Thanks for this info. It was a not so clear point to me.

Quote:
Did you set up the proerties correctly to begin with? Did you set the
TIdSocksInfo's Host, Port, Version, Authentication, Username and Password
properties?

Ok, I guess problems were happening because I was making the "MakeSocksConnection" call.

Thank you for your support!


Joao Lira.

Back to top
Joao Lira
Guest





PostPosted: Tue Apr 27, 2004 10:01 pm    Post subject: Re: Using TIdSMTP with SOCKS Reply with quote


Hello,

I´m still having trouble to get SOCKS working here. I´m using a TIdPOP3 to test that now. I set the 'TSocksInfo' properties (saNoAuthentication, localhost, 1080 and svSocks4). There is no username/password in my local SOCKS 4 server. I realized a strange behavior: looking at the SOCKS log I saw the SOCKS4 server is connecting using 127.0.0.1:110, but I´m connecting to a external POP3 server. I think the component is using the wrong address to call because I set my browser´s SOCKS field to point to the same local SOCKS server, and when it makes a connection the log entries for the HTTP are like 205.131.40.130:80, i.e., the external address to be accessed is passed to the SOCKS4 server instead the local (127.0.0.1) address, as it is been happening until now with my example, altough I´m setting the POP3 host correctly. Any idea about what could be happening here?

Thanks for any help.

Joao Lira.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Apr 27, 2004 10:12 pm    Post subject: Re: Using TIdSMTP with SOCKS Reply with quote


"Joao Lira" <joaolira (AT) mandic (DOT) com.br> wrote


Quote:
I´m still having trouble to get SOCKS working here. I´m using
a TIdPOP3 to test that now. I set the 'TSocksInfo' properties
(saNoAuthentication, localhost, 1080 and svSocks4).

What are ALL of your property settings for the TIdPOP3, TIdIOHanlderSocket,
and TIdSocksInfo?

Quote:
I think the component is using the wrong address to call

TIdSocksInfo will pass to the SOCKS server whatever Host/Port you set in the
TIdPOP3 itself. It does not change the values in any way.

Quote:
because I set my browser´s SOCKS field to point to the same
local SOCKS server, and when it makes a connection the log
entries for the HTTP are like 205.131.40.130:80, i.e., the external
address to be accessed is passed to the SOCKS4 server instead
the local (127.0.0.1) address, as it is been happening until now
with my example, altough I´m setting the POP3 host correctly.

Then I suggest you first double-check that all of your properties are
actually correct. If they are, then get yourself a packet sniffer and see
how the traffic between the browser and TIdPOP3 differs when connected to
the SOCKS server. If that sill doesn't work, then please make a new project
from scratch with minimal code that reproduces the same problem and then
post the project to the borland.public.attachments group for someone to look
at.


Gambit



Back to top
Joao Lira
Guest





PostPosted: Wed Apr 28, 2004 11:47 am    Post subject: Re: Using TIdSMTP with SOCKS Reply with quote

Hello,


First, thank you for your assistance.

Quote:
What are ALL of your property settings for the TIdPOP3, TIdIOHanlderSocket,
and TIdSocksInfo?

TIdPOP3: APOP --> false
ASCIIFilter --> false
BoundIP --> <empty>
BoundPort --> 0 (default)
Host --> <POP3 host to get the messages>
Intercept --> <empty>
IOHandler --> <TIdIOHandlerSocket> (the only one)
MaxLineAction--> maException
MaxLineLength--> 16384
Password --> <the required password>
Port --> 110
ReadTimeOut --> 0
RecvBufferSize-> 32768
SendBufferSize-> 32768
UserName --> <the required username>

TIdIOHandlerSocket:

SocksInfo --> <TIdSocksInfo> (the only one)
UseNagle --> true

TIdSocksInfo:

Authentication-> saNoAuthentication
Host --> localhost (Wingate at localhost)
Password --> <empty>
Port --> 1080
UserName --> <empty>
Version --> svSocks4

If I clear the 'IOHandler' property of TIdPOP3, when I do TIdPOP3.Connect, everything work as expected. If I set that property to the TIdIOHandlerSocket component as above set, when I do 'TIdPOP3.Connect' I get an 'EIdClosedSocket' exception. Nothing was changed in the original code, except the 'IOHandler' assigning.

I´m using Delphi 7 and Windows 2000 with administrative privilegies.


Thanks for any more idea!


Joao Lira.

Back to top
Joao Lira
Guest





PostPosted: Wed Apr 28, 2004 11:16 pm    Post subject: Re: Using TIdSMTP with SOCKS Reply with quote


Hello,


....
Quote:
I get an 'EIdClosedSocket' exception. Nothing was changed in > the original code, except the 'IOHandler' assigning.

If the 'TIdIOHandlerSocket' along with 'TIdSocksInfo' are able to make the SOCKS transactions transparent to the user when using a 'TIdTCPClient' component descendant, like 'TIdPOP3' what should still be 'open' to avoid the above exception? After many tries I can´t figure this out yet.

Thanks for any light.


Joao Lira.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.