DIRECTORY PupTypes, PupDefs, PupStream,
IO, Rope, Stream, PDUser;
PDChatServerStub:
CEDAR PROGRAM
IMPORTS PupDefs, PupStream, Stream, PDUser
NewConnection:
PROCEDURE [stream:
IO.
STREAM, pupAddress: PupDefs.PupAddress] =
TRUSTED {
otherGuy: Rope.ROPE ← PupDefs.GetHostName[pupAddress];
s: Stream.Handle ← Stream.FromIOStreams[stream, stream];
PDUser.TalkWithUser[s ! PupStream.StreamClosing => CONTINUE];
Stream.Delete[s];
};
pupListener: PupStream.PupListener ← PupStream.CreatePupByteStreamListener[
local: PupTypes.telnetSoc,
proc: NewConnection,
ticks: PupStream.SecondsToTocks[300]
];
END.