473,491 Members | 3,350 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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.)

Nov 21 '05 #1
4 5718
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

<WA****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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.)

Nov 21 '05 #2
Oh,
one more thing. When in doubt, consult Wikipedia :-)

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

--
Nathan

<WA****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
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.)

Nov 21 '05 #3
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

Nov 21 '05 #4
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

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2303
by: Rui | last post by:
I need to write a proxy between pop3 client and pop3+ssl server. This proxy will receive pop3 commands from the client and will translate those commands for a pop3+ssl server, then it will receive...
10
25084
by: Abubakar | last post by:
hi, I work on a computer that is part of a network and uses proxy to connect to net. I cant connect to servers outside my proxy with simple ConnectTo code. I need to know how to make my requests go...
4
4439
by: WATYF1 | last post by:
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,...
5
2734
by: Jim W | last post by:
I have an ASP.NET app that has very slow connect times using TCPClient, or the Socket class, or even calling a COM object that uses C socket calls on certain similar XP SP2 boxes. On those...
0
1346
by: Tamas Bojcan | last post by:
Hi, I use TcpClient class to obtain a NetworkStream object (via TcpClient's GetStream() method) in an ASP.Net webapp. This works well if I'm not behind proxy server but if I'm connected to the...
2
2086
by: Thief_ | last post by:
I need to monitor POP3 & IMAP servers for new emails. Ideally my app needs to sit in the system tray. Has anyone done this before? -- | +-- Thief_ | VB.NET 2003
2
1855
by: iwdu15 | last post by:
hey, i was wondering if 1) anyone could tell me whats wrong with my code, i did a little fixing to the msdn version fo this, or 2) how to make a simple program that will connect and listen for...
1
11291
by: Prasanta | last post by:
Hello, Please cnay one can tell me how to read mail as formatted.... i have made some code using that able to read but not able to serialize..... so am i need to parse the HTML, or is there any...
1
5668
by: Prasanta | last post by:
Hello, How to read a mail from the mail server as formatted. I am able to read the mail as row HTML, is there any class, or something method using that i can easily get the all info of that...
4
6276
by: =?Utf-8?B?QWxwYW5h?= | last post by:
I am making a thin email client and want to get emails from a pop3 server...Is there any built in support in C# to get emails from a pop3 server and parse the email to show up on the UI ?
0
7118
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1397
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.