Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have irssi running in screen, and I connect to it via ssh (with PuTTY). When I unexpectedly lose my ssh connection, if irssi was the active screen window, upon reconnecting/reattaching, it often drops and reconnects to all IRC servers. Is there any way to "insulate" it from the ssh session so it remains connected?

share|improve this question
up vote 2 down vote accepted

What's happening is that irssi tries to write something to screen (its terminal), and screen tries to write to your ssh connection. Screen's write is blocking, so it also blocks irssi, which then doesn't respond to PING from servers anymore, which then disconnect it.

The solution to tell screen not the block the application in it if screen blocks. You can do this with the nonblock screen command: ctrl-A :nonblock on. That just affects the current window in screen. To apply it to new windows by default use defnonblock on. And to do that everytime you start screen, put it in your ~/.screenrc:

defnonblock on

From man screen:

nonblock [on|off|numsecs]
Tell screen how to deal with user interfaces (displays) that cease to accept output. This can happen if a user presses ^S or a TCP/modem connection gets cut but no hangup is received. If nonblock is off (this is the default) screen waits until the display restarts to accept the output. If nonblock is on, screen waits until the timeout is reached (on is treated as 1s). If the display still doesn't receive characters, screen will consider it "blocked" and stop sending characters to it. If at some time it restarts to accept characters, screen will unblock the display and redisplay the updated window contents.
share|improve this answer
I just set the option both in the window and in .screenrc, and if I go longer than usual without this issue, I'll make sure to accept your answer. Thanks! – Andrew Brockert Nov 5 '10 at 5:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .