[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

making define-server work



    Date: Tue, 3 Jul 90 10:30:29 CDT
    From: aihaug@AUSTIN.LOCKHEED.COM (Daniel A Haug)


    Okay, this is probably really dumb.  I've never used the Generic Network
    System before, so bear with me.

    I defined the following server and protocol:

    (net:define-server :test (:medium :byte-stream :stream stream :no-close nil)
      (let ((msg (read-line stream)))
	(setq *most-recent-message* msg)))

    (net:define-protocol :test (:send-test :byte-stream)
      (:invoke-with-stream-and-close (stream msg)
	(write-line msg stream)))


    I also modified the namespace, and added the Chaos handler, as documentation
    says.  The problem is that when I invoke the service, both the server process
    and the user process hang in "Chaos Finish" state, forever.  

    I've spent a day working on this, and haven't got a clue as to why this
    is happening, nor what to do to remedy the situation.  Seems to me that
    both sides are waiting on the other side to close the connection.  And
    yet a :close message sent to the stream still performs a :finish
    on the stream first.  Forcing a :close on both sides doesn't work,
    nor does sending an :eof first.

    Any help would be appreciated.  I know this is probably a very trivial
    problem for everybody.

No, this is definitely *not* trivial; we've had lots of trouble with
this here, as well.  The problem is that Chaosnet has special rules
regarding closing a connection, to ensure that all the data in both
directions has been received.  The generic medium doesn't implement
these rules automatically.  Had you implemented your protocol on top of
TCP rather than Chaosnet you wouldn't have hung (however, TCP's simpler
connection-close protocol is also less reliable).

There's a section in the Networks manual titled "Chaosnet Connection
Closing" (p.247 in the Genera 8.0 version).  Unfortunately, it describes
the issues in terms of low-level protocols, not translated into
high-level stream operations.  My experience is that it usually involves
judicious use of FORCE-OUTPUT and STREAM-COPY-UNTIL-EOF, and sometimes
closing in abort mode.

                                                barmar