PC Review


Reply
Thread Tools Rate Thread

Connect to POP3 and IMAP4 through proxy using TCPClient...

 
 
WATYF1@gmail.com
Guest
Posts: n/a
 
      15th Mar 2005
Hello. I'm writing a VB.NET app to check email message counts for both
POP3 and IMAP4. I'm using TCPClient to connect, and a NetworkStream to
send simple commands. It's a very simple bit of code, actually... the
problem is, if the user is behind a proxy, then the Connect method
fails (times out).

How do I get around this? I thought this would be a common issue and
that there would be plenty of code out there to demonstrate how to
connect to mail servers from behind a proxy, but so far, all I've found
is people with the same problem as me, but no answers.

If there's a better object to use than TCPClient, then please post
example of how to implement the proxy, as well as how to send
commands/receive responses. Solutions in VB.NET or C# will do, I can
always convert code, if necessary.

Any help is appreciated. Thank you.


WATYF


(the next step will be coding for POP3 SSL connectivity, but that can
wait until I get over this hurdle.)

 
Reply With Quote
 
 
 
 
Nathan Neitzke
Guest
Posts: n/a
 
      16th Mar 2005
Are you sure this is being caused due to a proxy? There are two types of
proxy servers. The first is only used when a client is configured for it
(that is why the HttpWebRequest class actually has an attribute of type
WebProxy), and the second is a transient one such as NAT (which is a proxy
itself). That is why the HttpWebRequest and similar classes actually have a
proxy attribute - because they need to be specifically configured to use a
proxy. Since TCPClient is at a lower level than HttpWebRequest (it is app
protocol independent), it won't connect to the proxy server unless you
implement that functionality yourself - or the proxy server is a transient
one.

In the majority of cases though the only proxies that exist are ones that
require client configuration. So unless you specifically make a connection
to the proxy to make the request instead of the actual resource - the proxy
shouldn't be used.

Any more info you can give would help me help you :-)

Sorry I am not more help.

--
Nathan

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello. I'm writing a VB.NET app to check email message counts for both
> POP3 and IMAP4. I'm using TCPClient to connect, and a NetworkStream to
> send simple commands. It's a very simple bit of code, actually... the
> problem is, if the user is behind a proxy, then the Connect method
> fails (times out).
>
> How do I get around this? I thought this would be a common issue and
> that there would be plenty of code out there to demonstrate how to
> connect to mail servers from behind a proxy, but so far, all I've found
> is people with the same problem as me, but no answers.
>
> If there's a better object to use than TCPClient, then please post
> example of how to implement the proxy, as well as how to send
> commands/receive responses. Solutions in VB.NET or C# will do, I can
> always convert code, if necessary.
>
> Any help is appreciated. Thank you.
>
>
> WATYF
>
>
> (the next step will be coding for POP3 SSL connectivity, but that can
> wait until I get over this hurdle.)
>



 
Reply With Quote
 
Nathan Neitzke
Guest
Posts: n/a
 
      16th Mar 2005
Oh,
one more thing. When in doubt, consult Wikipedia :-)

http://en.wikipedia.org/wiki/Web_proxy

--
Nathan

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello. I'm writing a VB.NET app to check email message counts for both
> POP3 and IMAP4. I'm using TCPClient to connect, and a NetworkStream to
> send simple commands. It's a very simple bit of code, actually... the
> problem is, if the user is behind a proxy, then the Connect method
> fails (times out).
>
> How do I get around this? I thought this would be a common issue and
> that there would be plenty of code out there to demonstrate how to
> connect to mail servers from behind a proxy, but so far, all I've found
> is people with the same problem as me, but no answers.
>
> If there's a better object to use than TCPClient, then please post
> example of how to implement the proxy, as well as how to send
> commands/receive responses. Solutions in VB.NET or C# will do, I can
> always convert code, if necessary.
>
> Any help is appreciated. Thank you.
>
>
> WATYF
>
>
> (the next step will be coding for POP3 SSL connectivity, but that can
> wait until I get over this hurdle.)
>



 
Reply With Quote
 
WATYF
Guest
Posts: n/a
 
      16th Mar 2005
I'm fairly confident that it's the proxy. The identical code runs just
fine at home (no proxy) but it Fails during the TcpClient.Connect
method at work (behind proxy).

If there's something else it might be, please let me know... that's the
only thing that I can think of.


WATYF

 
Reply With Quote
 
WATYF
Guest
Posts: n/a
 
      16th Mar 2005
Here's the code, in case there was any ambiguity left... as you can
see, there's nothing more happening other than a simple TCPClient
connection being initiated.


Private tcp As TcpClient

'Connect to server
tcp = New TcpClient
tcp.ReceiveTimeout = 10000
tcp.Connect("mail.myserver.com", 110)


It fails at "tcp.Connect" and gives the following exception:

A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond.



WATYF

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
YMAIL Pop3 / IMAP4 / SMTP phone settings??? kmkreamer General Software 1 31st Mar 2009 08:25 PM
POP3 mails to IMAP4 inbox =?Utf-8?B?SWNhcnVz?= Microsoft Outlook Installation 1 11th Apr 2005 04:59 AM
Connect to POP3 and IMAP4 through proxy using TCPClient... WATYF1@gmail.com Microsoft C# .NET 4 16th Mar 2005 03:26 PM
Free pop3 or IMAP4 control? John Dalberg Microsoft ASP .NET 2 1st Sep 2004 07:13 PM
Re: Deleting moved messages from server (POP3/IMAP4) Jeff Stephenson [MSFT] Microsoft Outlook Discussion 0 7th Aug 2003 02:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:04 AM.