134 this.password = pass; |
134 this.password = pass; |
135 this.connect_callback = callback; |
135 this.connect_callback = callback; |
136 |
136 |
137 var conn = this; |
137 var conn = this; |
138 |
138 |
139 // Note that tcp.createConnection also initiates the connection. |
139 // Note that tcp.createConnection also initiates the connection. |
140 // This doesn't appear to create problems with adding listeners |
140 // This doesn't appear to create problems with adding listeners |
141 // afterward, but should be kept in mind should any arise. |
141 // afterward, but should be kept in mind should any arise. |
142 this.socket = tcp.createConnection(this.port, this.host) |
142 this.socket = tcp.createConnection(this.port, this.host) |
|
143 |
|
144 this.socket.setTimeout(0); // Because Node's default timeout is 60s |
143 |
145 |
144 this.socket.addListener("connect", recontext(this, conn._socket_connected)); |
146 this.socket.addListener("connect", recontext(this, conn._socket_connected)); |
145 this.socket.addListener("disconnect", recontext(this, conn._socket_disconnected)); |
147 this.socket.addListener("disconnect", recontext(this, conn._socket_disconnected)); |
146 this.socket.addListener("data", recontext(this, conn._socket_received)); |
148 this.socket.addListener("data", recontext(this, conn._socket_received)); |
147 |
149 |