How to drop TCP connection without killing process?

Kevin D. Clark kevin_d_clark at access-4-free.com
Tue May 25 16:01:01 EDT 2004


Larry Cook <lcook at sybase.com> writes:

>> What you're asking for is kindof weird
>
> Yes, I guess it is.  Let me explain:
>
> A POP3 server I use doesn't send a response on occasion.  This causes
> Mozilla to stop checking that POP3 account because the connection is
> still up.  And the connection just stays up, with no traffic, as far
> as I can tell.  I'd like to force that connection to drop so that
> Mozilla will start checking that account again.  And I like to do this
> without having to stop and restart Mozilla.

Perhaps the attached script will do the trick?  My version of Mozilla
doesn't seem to object to this sort of chicanery.

Regards,

--kevin


  #!/bin/sh
  
  # you need to modify these
  POP_SERVER="pop.isp.net"
  POP_PORT=110
  
  LSOF=`lsof -i tcp@$POP_SERVER:$POP_PORT | egrep '[m]ozilla'`
  
  PID=`echo "$LSOF" | awk '{print $2}' | sed -n 1p`
  FDS=`echo "$LSOF" | awk '{print $4}' | tr -cd '[:digit:]\n' | sort -u`
  
  GDBX=/tmp/gdb-close-mozilla-pop-fds-$$
  
  
  echo "attach $PID" >"$GDBX"
  for fd in $FDS ; do
    echo "call close($fd)" >>"$GDBX"
  done
  echo detach >>"$GDBX"
  
  gdb -batch -x "$GDBX"
  rm -f "$GDBX"
  




More information about the gnhlug-discuss mailing list