# Debugging a TCPSocket.open timeout

**URL:** <https://www.ruby-forum.com/t/debugging-a-tcpsocket-open-timeout/138169>\
**Category:** Ruby\
**Created:** [May 20, 2008, 7:46pm UTC](https://www.ruby-forum.com/t/debugging-a-tcpsocket-open-timeout/138169 "2008-05-20T19:46:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@student](https://www.ruby-forum.com/u/student)\
**Post date:** [May 20, 2008, 7:46pm UTC](https://www.ruby-forum.com/t/debugging-a-tcpsocket-open-timeout/138169/1 "2008-05-20T19:46:44Z")

</div>

I’m trying to do an IMAP connection. My first target is gmail:

Net::IMAP.new(“[imap.gmail.com](http://imap.gmail.com)”, 143)

goes walkabout on line 886:

TCPSocket.open(“[imap.gmail.com](http://imap.gmail.com)”, 143)

AT&T swears they are not port blocking. My system logs are clean.

The code for TCPSocket is compiled in, so inserting printfs is going to  
be really painful. Moreover, the actual error is probably a ways down  
the stack.

Ideas?

---

<div class="post-metadata">

**Author:** ![student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@student](https://www.ruby-forum.com/u/student)\
**Post date:** [May 20, 2008, 8:36pm UTC](https://www.ruby-forum.com/t/debugging-a-tcpsocket-open-timeout/138169/2 "2008-05-20T20:36:01Z")

</div>

Student Jr wrote:

> The code for TCPSocket is compiled in, so inserting printfs is going to  
> be really painful. Moreover, the actual error is probably a ways down  
> the stack.
> 
> Ideas?

What about trying netcat? Not sure that will give more info than tcp  
open, but if you have to convince someone, it’s better than saying “my  
ruby program doesn’t work”.

---

<div class="post-metadata">

**Author:** ![student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@student](https://www.ruby-forum.com/u/student)\
**Post date:** [May 20, 2008, 8:55pm UTC](https://www.ruby-forum.com/t/debugging-a-tcpsocket-open-timeout/138169/3 "2008-05-20T20:55:03Z")

</div>

Joel VanderWerf wrote:

> Student Jr wrote:
> 
> > The code for TCPSocket is compiled in, so inserting printfs is going to  
> > be really painful. Moreover, the actual error is probably a ways down  
> > the stack.
> > 
> > Ideas?
> 
> What about trying netcat? Not sure that will give more info than tcp  
> open, but if you have to convince someone, it’s better than saying “my  
> ruby program doesn’t work”.

sudo nc -v -v [imap.gmail.com](http://imap.gmail.com) 143  
DNS fwd/rev mismatch: [gmail-imap.l.google.com](http://gmail-imap.l.google.com) != [py-in-f109.google.com](http://py-in-f109.google.com)  
DNS fwd/rev mismatch: [gmail-imap.l.google.com](http://gmail-imap.l.google.com) != [py-in-f111.google.com](http://py-in-f111.google.com)

I don’t know what to expect, so I don’t know if this really means  
anything or not…

---

<div class="post-metadata">

**Author:** ![student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@student](https://www.ruby-forum.com/u/student)\
**Post date:** [May 20, 2008, 9:23pm UTC](https://www.ruby-forum.com/t/debugging-a-tcpsocket-open-timeout/138169/4 "2008-05-20T21:23:22Z")

</div>

Phillip G. wrote:

> Student Jr wrote:  
> | I’m trying to do an IMAP connection. My first target is gmail:  
> |  
> | Net::IMAP.new(“[imap.gmail.com](http://imap.gmail.com)”, 143)  
> |  
> | goes walkabout on line 886:  
> |  
> | TCPSocket.open(“[imap.gmail.com](http://imap.gmail.com)”, 143)  
> |  
> | AT&T swears they are not port blocking. My system logs are clean.  
> |  
> | The code for TCPSocket is compiled in, so inserting printfs is going to  
> | be really painful. Moreover, the actual error is probably a ways down  
> | the stack.  
> |  
> | Ideas?
> 
> Have you followed (well, as much as possible :P) the instructions GMail  
> provides for configuring email clients for IMAP?
> 
> When I used Thunderbird on Ubuntu 8.04 to connect to Google’s IMAP, I  
> had no problems.

> Write clearly - don’t be too clever.

Funny what the infamous “one more look” can do. They are using a  
different port. This nicely deals with the immediate example  
problem–the long timeout on a bad connection is going to have to be  
handled via shelling out anyway, I guess.

---

<div class="post-metadata">

**Author:** ![student](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@student](https://www.ruby-forum.com/u/student)\
**Post date:** [May 20, 2008, 9:17pm UTC](https://www.ruby-forum.com/t/debugging-a-tcpsocket-open-timeout/138169/5 "2008-05-20T21:17:24Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Student Jr wrote:  
| I’m trying to do an IMAP connection. My first target is gmail:  
|  
| Net::IMAP.new(“[imap.gmail.com](http://imap.gmail.com)”, 143)  
|  
| goes walkabout on line 886:  
|  
| TCPSocket.open(“[imap.gmail.com](http://imap.gmail.com)”, 143)  
|  
| AT&T swears they are not port blocking. My system logs are clean.  
|  
| The code for TCPSocket is compiled in, so inserting printfs is going to  
| be really painful. Moreover, the actual error is probably a ways down  
| the stack.  
|  
| Ideas?

Have you followed (well, as much as possible :P) the instructions GMail  
provides for configuring email clients for IMAP?

When I used Thunderbird on Ubuntu 8.04 to connect to Google’s IMAP, I  
had no problems.

* * *

Phillip G.  
Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)  
Blog: [http://justarubyist.blogspot.com](http://justarubyist.blogspot.com)

Write clearly - don’t be too clever.  
~ - The Elements of Programming Style (Kernighan & Plaugher)  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iEYEARECAAYFAkgzIUcACgkQbtAgaoJTgL+99ACdHi40kwAUQkpeD2Vh9qknX737  
vbkAoIANsiX0JMD0qlB+Nc7pR9xdZmqr  
=5ecP  
-----END PGP SIGNATURE-----
