home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / next / programm / 7955 < prev    next >
Encoding:
Internet Message Format  |  1992-12-31  |  2.5 KB

  1. Path: sparky!uunet!psinntp!sugar!tghost!unkaphaed!biff!biff
  2. From: biff@biff.gbdata.com (Dwight Everhart)
  3. Newsgroups: comp.sys.next.programmer
  4. Subject: Sending objects between processes
  5. Keywords: typedstream stream Speaker Listener NXWriteObject NXReadObject
  6. Message-ID: <C03x19.Jx2@biff.gbdata.com>
  7. Date: Thu, 31 Dec 1992 04:41:32 GMT
  8. Sender: biff@biff.gbdata.com (Dwight Everhart)
  9. Lines: 38
  10.  
  11. I'm writing a software system involving a server process and several client  
  12. processes.  I'm writing them in Objective-C, although the server is a daemon,  
  13. not an application (it doesn't have a NXApp).  The clients may or may not be  
  14. applications.  I'm using Speaker and Listener objects for the RPC requests.
  15.  
  16. I need to be able to send objects between the clients and the server.  I  
  17. first tried sending them as a char blocks in the Speaker/Listener messages.   
  18. That worked fairly well, but I ran into problems when the class of the object  
  19. sent was not linked into the server.  (I'm dynamically loading classes as  
  20. they're needed.)  I was also confused about whether the memory was being  
  21. copied and who was responsible for freeing it.
  22.  
  23. My second (and latest) approach is to use typed streams on ports, and send  
  24. the objects using NXWriteObject() and NXReadObject().  However, I'm having a  
  25. problem opening the typed streams for reading.  When I call  
  26. NXOpenTypedStream(), it hangs, apparently blocking on the stream.  I assumed  
  27. it was trying to read some header information identifying the type or version  
  28. of the stream, so I had the client send an object before the server tried to  
  29. open the stream.  Same thing happened.
  30.  
  31. What am I doing wrong?  I'm having the client create the port and give the  
  32. server receive rights through a Speaker/Listener message.  The client creates  
  33. the stream and typed stream on its end for writing, and the server takes the  
  34. port given and creates a stream and typed stream for reading.  I don't want  
  35. to send any objects at this point in the code.  I just want to establish  
  36. ports and streams for sending and receiving objects later.  Does  
  37. NXOpenTypedStream() try to read the stream, and, if so, why didn't it read  
  38. the object the client sent?
  39.  
  40. If you know of a better way to send objects between processes, please  
  41. explain.  I'm running 2.0, so I don't have distributed objects.  Do they  
  42. offer a better approach?
  43.  
  44. --
  45. Dwight Everhart          "You can't do a musical number about elephants
  46. Houston, Texas            without it being obvious." -- Roger Ebert
  47. biff@biff.gbdata.com     
  48. NeXTMail and MIME OK     
  49.