🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #100010

TCP connection bug?

#100010
From: Shinichirou Sugou
Date: Mon, 05 Mar 1990 07:21
105 lines
3540 bytes
Hello.

I have some trouble about TCP connection.

EmacsLisp manual says nothing about the function who does
'close socket procedure'. 

I think (delete-process ...) must do that job.

Does (delete-process ...) (or any other function) really do closing socket
procedure?

I'll explain the situation why this causes problem.

If the client program (this is EmacsLisp program) closes the socket BEFORE the
server program does, no problem happens.  Following is the scheme.


      client (EmacsLisp)        |   server
    -------------------------------------------------------------

                     establish socket connection

     send data                ----->

                              <-----          send reply

     close socket by
        (delete-process ...)

                                              detect socket closure by
                                                  end-of-file

                                              then, close socket

In the above case, (delete-process ...) seems to close socket.

But, let's see the next example.

In this example, the server program closes the socket BEFORE the client
program (EmacsLisp program) does, and problem happens.

      client (EmacsLisp)        |   server
    -------------------------------------------------------------

       (setq delete-exited-processes nil) ;; see the comment below

                     establish socket connection

     send data                ----->

                              <-----          send reply

                                              close the socket

     detect socket closure by
        (process-status ...)
        returns 'closed'

     then, try to close the socket
        by (delete-process ...)


               but, it seems that socket does not closed completely


First, I explain why

    (setq delete-exited-processes nil)

is needed.

If that variable is t (its default value is t), (process-status ...) returns
nil as soon as the server closes the socket.  Therefore, it becomes impossible
to invoke

    (delete-process ...)

since

    (delete-process ...)

warns

    Process ... does not exist

To return to our subject, the socket seems not to be closed completely.  You
will notice this fact by trying to re-open the same socket SOON will fail with
the error message "The address is already in use".

This message implies that socket closing procedure is incomplete, and it may
be caused by (delete-process ...).

Any suggestion?


CAUTION: (1) Reply-command in the mail system may NOT generate my address
             correctly.  Please use the following address instead.

               shin%sgtp.apple.juice.or.jp@uunet.uu.net

         (2) I have no relation to Apple Computer Inc. :-)

---
S.Sugou
Technical Details
Message-ID: <9003050721.AA11666@sgtp.apple.juice.or.jp>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!apple!usc!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!tut.cis.ohio-state.edu!sgtp.apple.juice.or.jp!shin

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,4f206ccc2658188f,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-03-04 23:21:02 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!apple!usc!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!tut.cis.ohio-state.edu!sgtp.apple.juice.or.jp!shin
From: shin@sgtp.apple.juice.or.jp (Shinichirou Sugou)
Newsgroups: gnu.emacs.bug
Subject: TCP connection bug?
Message-ID: <9003050721.AA11666@sgtp.apple.juice.or.jp>
Date: 5 Mar 90 07:21:02 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 105
Posted: Mon Mar  5 08:21:02 1990