[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

145.0. "talking to a second terminal" by ELMO::LEIGH () Thu Aug 01 1985 09:55

I need your help.  I would like to have one process talk to another
terminal (besides default logged in terminal).  This is fine and
not that hard when the second terminal is a TT or TX or whatever hard
wired into the VAX.  The problem comes with remote terminals and LAT
terminals.  Is it possible to talk to another terminal that is logged
in under a different process?  That would allow me to talk to LATs and
remote terminals.  I need it for a two-player game I am writing and
I don't want to limit the game to people who are hard-wired into the
VAX (as we seem to be going to LATs (at least in ZK)).

Thanks in advance
Chad

T.RTitleUserPersonal
Name
DateLines
145.1MELODY::NIKOPOULOSThu Aug 01 1985 16:557
You could use a mailbox for communication between two jobs.
I think that there is a version of FOOTBALL that uses 
mailboxes for a multi-terminal game.


Steve.

145.2SPRITE::OSMANThu Aug 01 1985 20:4939
In my library, called SPRITE::USER1:[OSMAN.BLISSLIB], is a module that I
believe you could use quite easily.  It's called

	MAILBOX.OBJ

If you link it with your programs on each terminal, you could easily
establish communication.  For instance, when you want to send characters
from one process's terminal to the other, call

	SEND_MAIL_WAIT_NO_RSVP (pid, message-len, message-adr)

which sends the specified message (such as a string) to the specified process.

The other end merely executes

	READ_MAIL_WAIT (max-length, message-adr, actual-length, pid)

to read messages.  The actual-length and pid get filled in when the message
arrives, indicating exactly how long it is and who sent it.  If you then
type the received message on the terminal, you've effectively sent a message
from one terminal to another.

If you don't want to sit around waiting for a message, call

	SET_MAILBOX_READ_AST (astadr, astprm)

which will cause the routine specified by "astadr" to be called when
a message is available.  (The routine may then call READ_MAIL_WAIT_NO_RSVP
to read it.)

Feel free to try all this by copying MAILBOX.OBJ.  You'll need
to also link with TERMNL.OBJ and LINKED_BLOCKS.OBJ.  If you want the sources,
they're all in BLISSLIB: too.

Good luck!  Oh, by they way, if you win with it, let me know.  It helps
the ambition :-)

/Eric

145.3ELMO::LEIGHFri Aug 02 1985 13:0816
Yeah,
I am using mailboxes.  There is a basic SERVER process and two PLAYER processes.
The PLAYER processes each have a mailbox to talk to the SERVER and there
is a central MAILBOX that acts as a request queue that all PLAYERS can talk
to.  My problem is that the mailbox logicals are being set up at a local
level.  If user JOE sets up the game, user SAM's process can't find the
logicals for them.  I tried inserting them in the system table, but my
call to $CRELNM came up with a SS$_ACCVIO error and I couldn't figure out
why.  The native language is PASCAL.  I am a novice when it comes to the
nitty gritty of VAX/VMS so all help would be appreciated.  The game is
a two-player EMPIRE.  

re: -.1
I'll look into them. thanks
Chad

145.4KOALA::ROBINSFri Aug 02 1985 17:406
Try putting the logicals in the group table.  They can't get into the system
table unless the users have sysprv (or something like that).  To get into the
group tables, they only need GROUP privs (or grpnam).  that is how the
FOOTBALL program works.

Scott.
145.5ELMO::LEIGHFri Aug 02 1985 18:384
I have the SYSNAM privilege but that (GROUP table) is a good idea.
Thanks
Chad

145.6KLOV03::BROWNThu Aug 08 1985 12:099
Another way to have interprocess communication that can be quite effective
(I have used it to communicate between terminals) is to used shared memory
(sections they are called I think). This allows two programs (or two copies
of the same program being run from different terminals) to have a shared
memory space that they can both access. Common event flags can be used for
synchronization if required.

Stephen Brown

145.7TOOLS::COWANFri Aug 09 1985 20:2617
	Although this may not be the best solution to your problem, there
is a way to treat a LAT terminal like a hardwired one before someone
logs in on it.

	Try the following:

	LAT> SET TERM OTHER
	LAT> CONN ZEKE  (hit only one return)

On another terminal (or session) find the LT device that just got
created.   It status will be different that the ones in use.  I think
the status is "available".  From that terminal, allocate the device.
Then you can read and write to the device just like it was a spare 
hardwired terminal.

	KC