You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jason Warner <ja...@gmail.com> on 2006/12/04 22:05:24 UTC
while(true) in getConnectedSSLSocket Method in SMTPTransport.java
Hey all,
I was looking at the getConnectedSSLSocket method in the
SMTPTransport.javaclass for javamail and I was confused. There is a
section that consists of
a while loop whose condition is true. Within this while loop is code to
create a socket connection with a server. I am confused as to how this
works. Shouldn't there be some condition such that if the socket has been
connected then you break out of the while loop? I used this piece of code
in the pop3Connection class for establishing an SSL connection when using
pop3. When I try to run it I get a bind exception. I believe this is
caused by that while loop not being exited when the socket is created. I
can add in those break statements but I was curious how it works for smtp.
There are no break statements in that piece of code so I was wondering if
there's another way it works. Is there a different reason why creating the
socket would break out of the while loop that I'm not encountering? Thanks.
Jason
Re: while(true) in getConnectedSSLSocket Method in SMTPTransport.java
Posted by Rick McGuire <ri...@gmail.com>.
Jason Warner wrote:
> Hey all,
>
> I was looking at the getConnectedSSLSocket method in the
> SMTPTransport.java class for javamail and I was confused. There is a
> section that consists of a while loop whose condition is true. Within
> this while loop is code to create a socket connection with a server.
> I am confused as to how this works. Shouldn't there be some condition
> such that if the socket has been connected then you break out of the
> while loop? I used this piece of code in the pop3Connection class for
> establishing an SSL connection when using pop3. When I try to run it
> I get a bind exception. I believe this is caused by that while loop
> not being exited when the socket is created. I can add in those break
> statements but I was curious how it works for smtp. There are no
> break statements in that piece of code so I was wondering if there's
> another way it works. Is there a different reason why creating the
> socket would break out of the while loop that I'm not encountering?
> Thanks.
What you're seeing is code that's probably never been tested :-) I
suspect this has only ever been used with the non-factory version, and
there should be a "break" right before the catch inside the loop.
Rick
>
> Jason