home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / Broadcast / Lib / ListenerAdditions.m < prev    next >
Encoding:
Text File  |  1992-12-21  |  818 b   |  39 lines

  1. #import <servers/netname.h>
  2. #import "ListenerAdditions.h"
  3.  
  4. @implementation Listener(PublicPort)
  5.  
  6. /*
  7.  * This method should be used INSTEAD OF -checkInAs:, not in addition to it.
  8.  * Using both may lead to problems later if checked in again under the same 
  9.  * name.
  10.  */
  11. - (int)publicCheckInAs:(const char *)name
  12. {
  13.     kern_return_t result;
  14.     
  15.     if (![self listenPort]) {
  16.         /* 
  17.          * Causes Listener to alloc a port.
  18.          */
  19.         [self usePrivatePort];
  20.     }
  21.     
  22.     /*
  23.      * Now register the port with the Network Name Server.
  24.      */
  25.     result = netname_check_in(name_server_port,
  26.         (char *)name,[self signaturePort],[self listenPort]);
  27.     if (result != NETNAME_SUCCESS)
  28.         return result;
  29.     
  30.     /*
  31.      * Set my portName to be the registed name.
  32.      */
  33.     free(portName);
  34.     portName = NXCopyStringBufferFromZone(name, [self zone]);
  35.     return 0;
  36. }
  37.  
  38. @end
  39.