🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #2002

Sending objects between processes

#2002
From: Dwight Everhart
Date: Thu, 31 Dec 1992 04:41
38 lines
2614 bytes
I'm writing a software system involving a server process and several client  
processes.  I'm writing them in Objective-C, although the server is a daemon,  
not an application (it doesn't have a NXApp).  The clients may or may not be  
applications.  I'm using Speaker and Listener objects for the RPC requests.

I need to be able to send objects between the clients and the server.  I  
first tried sending them as a char blocks in the Speaker/Listener messages.   
That worked fairly well, but I ran into problems when the class of the object  
sent was not linked into the server.  (I'm dynamically loading classes as  
they're needed.)  I was also confused about whether the memory was being  
copied and who was responsible for freeing it.

My second (and latest) approach is to use typed streams on ports, and send  
the objects using NXWriteObject() and NXReadObject().  However, I'm having a  
problem opening the typed streams for reading.  When I call  
NXOpenTypedStream(), it hangs, apparently blocking on the stream.  I assumed  
it was trying to read some header information identifying the type or version  
of the stream, so I had the client send an object before the server tried to  
open the stream.  Same thing happened.

What am I doing wrong?  I'm having the client create the port and give the  
server receive rights through a Speaker/Listener message.  The client creates  
the stream and typed stream on its end for writing, and the server takes the  
port given and creates a stream and typed stream for reading.  I don't want  
to send any objects at this point in the code.  I just want to establish  
ports and streams for sending and receiving objects later.  Does  
NXOpenTypedStream() try to read the stream, and, if so, why didn't it read  
the object the client sent?

If you know of a better way to send objects between processes, please  
explain.  I'm running 2.0, so I don't have distributed objects.  Do they  
offer a better approach?

--
Dwight Everhart          "You can't do a musical number about elephants
Houston, Texas            without it being obvious." -- Roger Ebert
biff@biff.gbdata.com     
NeXTMail and MIME OK     
Technical Details
Message-ID: <C03x19.Jx2@biff.gbdata.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!sugar!tghost!unkaphaed!biff!biff

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!sugar!tghost!unkaphaed!biff!biff
From: biff@biff.gbdata.com (Dwight Everhart)
Newsgroups: comp.sys.next.programmer
Subject: Sending objects between processes
Keywords: typedstream stream Speaker Listener NXWriteObject NXReadObject
Message-ID: <C03x19.Jx2@biff.gbdata.com>
Date: Thu, 31 Dec 1992 04:41:32 GMT
Sender: biff@biff.gbdata.com (Dwight Everhart)
Lines: 38