March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
|
|
@ -3,38 +3,33 @@
|
|||
|
||||
int main (void)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
ActionObject *action;
|
||||
NSConnection *connect;
|
||||
NSSocketPort *port;
|
||||
@autoreleasepool {
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
ActionObject *action = [[ActionObject alloc] init];
|
||||
|
||||
action = [[ActionObject alloc] init];
|
||||
NSSocketPort *port = (NSSocketPort *)[NSSocketPort port];
|
||||
// initWithTCPPort: 1234 and other methods are not supported yet
|
||||
// by GNUstep
|
||||
NSConnection *connect = [NSConnection
|
||||
connectionWithReceivePort: port
|
||||
sendPort: port]; // or sendPort: nil
|
||||
|
||||
port = (NSSocketPort *)[NSSocketPort port];
|
||||
// initWithTCPPort: 1234 and other methods are not supported yet
|
||||
// by GNUstep
|
||||
connect = [NSConnection
|
||||
connectionWithReceivePort: port
|
||||
sendPort: port]; // or sendPort: nil
|
||||
[connect setRootObject: action];
|
||||
|
||||
[connect setRootObject: action];
|
||||
/* "vend" the object ActionObject as DistributedAction; on GNUstep
|
||||
the Name Server that allows the resolution of the registered name
|
||||
is bound to port 538 */
|
||||
if (![connect registerName:@"DistributedAction"
|
||||
withNameServer: [NSSocketPortNameServer sharedInstance] ])
|
||||
{
|
||||
NSLog(@"can't register the server DistributedAction");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
NSLog(@"waiting for messages...");
|
||||
|
||||
[[NSRunLoop currentRunLoop] run];
|
||||
|
||||
/* "vend" the object ActionObject as DistributedAction; on GNUstep
|
||||
the Name Server that allows the resolution of the registered name
|
||||
is bound to port 538 */
|
||||
if ([connect registerName:@"DistributedAction"
|
||||
withNameServer: [NSSocketPortNameServer sharedInstance] ] == NO)
|
||||
{
|
||||
NSLog(@"can't register the server DistributedAction");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
NSLog(@"waiting for messages...");
|
||||
|
||||
[[NSRunLoop currentRunLoop] run];
|
||||
|
||||
[pool release];
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,41 +3,36 @@
|
|||
|
||||
int main(void)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
NSArray *args;
|
||||
id <ActionObjectProtocol> action;
|
||||
NSString *msg, *backmsg;
|
||||
@autoreleasepool {
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
id <ActionObjectProtocol> action = (id <ActionObjectProtocol>)
|
||||
[NSConnection
|
||||
rootProxyForConnectionWithRegisteredName: @"DistributedAction"
|
||||
host: @"localhost"
|
||||
usingNameServer: [NSSocketPortNameServer sharedInstance] ];
|
||||
|
||||
action = (id <ActionObjectProtocol>)
|
||||
[NSConnection
|
||||
rootProxyForConnectionWithRegisteredName: @"DistributedAction"
|
||||
host: @"localhost"
|
||||
usingNameServer: [NSSocketPortNameServer sharedInstance] ];
|
||||
if (action == nil)
|
||||
{
|
||||
NSLog(@"can't connect to the server");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
NSArray *args = [[NSProcessInfo processInfo] arguments];
|
||||
|
||||
if ([args count] == 1)
|
||||
{
|
||||
NSLog(@"specify a message");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
NSString *msg = args[1];
|
||||
|
||||
// "send" (call the selector "sendMessage:" of the (remote) object
|
||||
// action) the first argument's text as msg, store the message "sent
|
||||
// back" and then show it in the log
|
||||
NSString *backmsg = [action sendMessage: msg];
|
||||
NSLog("%@", backmsg);
|
||||
|
||||
if (action == nil)
|
||||
{
|
||||
NSLog(@"can't connect to the server");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
args = [[NSProcessInfo processInfo] arguments];
|
||||
|
||||
if ([args count] == 1)
|
||||
{
|
||||
NSLog(@"specify a message");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
msg = [args objectAtIndex: 1];
|
||||
|
||||
// "send" (call the selector "sendMessage:" of the (remote) object
|
||||
// action) the first argument's text as msg, store the message "sent
|
||||
// back" and then show it in the log
|
||||
backmsg = [action sendMessage: msg];
|
||||
NSLog("%@", backmsg);
|
||||
|
||||
[pool release];
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue