Re: Problem with distributed objects in GUI cocoa apps

2014-04-30 Thread Costas Chatzinikolas
Thank you very much.

I had already solved the problem before yor response.
It had to do with disabling sandboxing at all.

However i will follow your advice and start reading about NSXPCConnection.

One quick question: DO API is not available on iOS. Do you know if
NSXPCConnection is?


2014-04-24 8:32 GMT+03:00 Charles Srstka cocoa...@charlessoft.com:

 On Mar 30, 2014, at 3:28 AM, Costas Chatzinikolas 
 costas.chatziniko...@gmail.com wrote:

  Hi everyone,
 
  i recently made a set of 2 command lines apps in Cocoa, that use
  Distributed objects to communicate. In fact, the first app is the client
  that sends a message, the second app is the server the vends the object.
  Everything works ok!!!
 
  Then i tried to make these 2 apps GUI based. I used the same code. The
  server vends the object, but the client is unable to get the connection.
 It
  always gets a nil connection. In fact when i check the number of
 available
  connections from the client using:
 
  [NSConnection allConnections]
 
  it always return zero connections. The only difference in my code is that
  in the GUI server app, i don't use:
 
  [[NSRunLoop currentRunLoop] run]
 
  since the GUI app has its own runLoop.
 
  I also have enabled the sandbox networking capabilities for both GUI
 apps.
 
  Has anyone experience this behavior before me?
 
  Thanks in advance...

 Distributed Objects is pretty old and crusty at this point. You might want
 to look into NSXPCConnection instead, which fixes a lot of problems that DO
 had, and is likely to be better supported.

 Charles


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Problem with distributed objects in GUI cocoa apps

2014-04-30 Thread Kevin Meaney
Hi Costas,

I'd be interested in hearing the results of you following up NSXPCConnection.

When I read through the documentation about a year ago, it is focussed around 
providing a xpcservice which is a bundled executable within an application, and 
the application communicates with it using NSXPCConnection.

The NSXPCConnection can also be used for communicating with a LaunchAgent or a 
LaunchDaemon but I found the process of getting a LaunchAgent working as I 
found it difficult to separate what documentation was specific to an xpcservice 
and what was needed to be done differently for a LaunchAgent. I got there in 
the end, and I have the LaunchAgent side of things working and have a minimal 
project which demonstrates a working LaunchAgent. 
https://github.com/SheffieldKevin/LaunchAgent

The big BUT though is. I could never see how you could use NSXPCConnection to 
communicate between two applications. I would be interested to know how this 
can be done which is why I'd be interested in hearing the results of your 
examination of NSXPCConnection.

Kevin
 
On 30 Apr 2014, at 07:49, Costas Chatzinikolas costas.chatziniko...@gmail.com 
wrote:

 Thank you very much.
 
 I had already solved the problem before yor response.
 It had to do with disabling sandboxing at all.
 
 However i will follow your advice and start reading about NSXPCConnection.
 
 One quick question: DO API is not available on iOS. Do you know if
 NSXPCConnection is?
 
 
 2014-04-24 8:32 GMT+03:00 Charles Srstka cocoa...@charlessoft.com:
 
 On Mar 30, 2014, at 3:28 AM, Costas Chatzinikolas 
 costas.chatziniko...@gmail.com wrote:
 
 Hi everyone,
 
 i recently made a set of 2 command lines apps in Cocoa, that use
 Distributed objects to communicate. In fact, the first app is the client
 that sends a message, the second app is the server the vends the object.
 Everything works ok!!!
 
 Then i tried to make these 2 apps GUI based. I used the same code. The
 server vends the object, but the client is unable to get the connection.
 It
 always gets a nil connection. In fact when i check the number of
 available
 connections from the client using:
 
 [NSConnection allConnections]
 
 it always return zero connections. The only difference in my code is that
 in the GUI server app, i don't use:
 
 [[NSRunLoop currentRunLoop] run]
 
 since the GUI app has its own runLoop.
 
 I also have enabled the sandbox networking capabilities for both GUI
 apps.
 
 Has anyone experience this behavior before me?
 
 Thanks in advance...
 
 Distributed Objects is pretty old and crusty at this point. You might want
 to look into NSXPCConnection instead, which fixes a lot of problems that DO
 had, and is likely to be better supported.
 
 Charles
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/ktam%40yvs.eu.com
 
 This email sent to k...@yvs.eu.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Problem with distributed objects in GUI cocoa apps

2014-04-30 Thread Jens Alfke

On Apr 29, 2014, at 11:49 PM, Costas Chatzinikolas 
costas.chatziniko...@gmail.com wrote:

 One quick question: DO API is not available on iOS. Do you know if 
 NSXPCConnection is?

No, because iOS apps aren’t allowed to create new processes, so there would be 
no agents for you to communicate with.

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Problem with distributed objects in GUI cocoa apps

2014-04-30 Thread Costas Chatzinikolas
So if i want to create two apps (one for Mac OS X - one for iOS) that speak
to each other,
i have to use sockets. Am i correct?


2014-04-30 17:16 GMT+03:00 Jens Alfke j...@mooseyard.com:


 On Apr 29, 2014, at 11:49 PM, Costas Chatzinikolas 
 costas.chatziniko...@gmail.com wrote:

 One quick question: DO API is not available on iOS. Do you know if 
 NSXPCConnection
 is?


 No, because iOS apps aren’t allowed to create new processes, so there
 would be no agents for you to communicate with.

 —Jens

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Problem with distributed objects in GUI cocoa apps

2014-04-30 Thread Jens Alfke

On Apr 30, 2014, at 11:19 AM, Costas Chatzinikolas 
costas.chatziniko...@gmail.com wrote:

 So if i want to create two apps (one for Mac OS X - one for iOS) that speak 
 to each other,
 i have to use sockets. Am i correct?

Yes. DO between computers (over TCP) was never really supported on OS X, and 
has a number of security and reliability problems that would make it a really 
bad idea for any real-world use. (I know, because I tried to do that once.) And 
AFAIK, XPC is purely intra-computer.

(Frankly, _any_ API for networked communication that tries to make network 
calls look just like regular function calls is a bad idea. Distributed and 
local computing are very, very different, and papering over the differences 
will lead the client code straight into the well-known fallacies of distributed 
computing*.)

I have a framework called MYNetwork** that provides a fairly clean high-level 
API for letting two apps talk to each other. People have been using WebSockets 
lately too, but to my knowledge there aren’t any really good WebSocket client 
and server libraries for Cocoa yet.

—Jens

* http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing
** https://github.com/snej/mynetwork
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Problem with distributed objects in GUI cocoa apps

2014-04-30 Thread Gerd Knops

On Apr 30, 2014, at 2:39 PM, Jens Alfke j...@mooseyard.com wrote:

 Yes. DO between computers (over TCP) was never really supported on OS X,

It most certainly was supported, and useable on a LAN (and even on a WAN over 
VPN, did not try it in the wild).

 and has a number of security and reliability problems

True.

 that would make it a really bad idea for any real-world use.

For the right context (non-mission critical convenience functionality, for 
example on top of zero-conf service discovery) it was (is?) a useable solution.

Gerd


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Problem with distributed objects in GUI cocoa apps

2014-04-30 Thread ChanMaxthon
If you are targeting at remote procedure calling across Internet I have a 
library CGIJSONObjects that wraps REST-style JSON-based HTTP remote calls into 
objects. Server side language is not important. I used it to interface a server 
using Java servlets.

Sent from my iPhone

 On May 1, 2014, at 4:04 AM, Gerd Knops gerti-cocoa...@bitart.com wrote:
 
 
 On Apr 30, 2014, at 2:39 PM, Jens Alfke j...@mooseyard.com wrote:
 
 Yes. DO between computers (over TCP) was never really supported on OS X,
 
 It most certainly was supported, and useable on a LAN (and even on a WAN over 
 VPN, did not try it in the wild).
 
 and has a number of security and reliability problems
 
 True.
 
 that would make it a really bad idea for any real-world use.
 
 For the right context (non-mission critical convenience functionality, for 
 example on top of zero-conf service discovery) it was (is?) a useable 
 solution.
 
 Gerd
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/xcvista%40me.com
 
 This email sent to xcvi...@me.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Problem with distributed objects in GUI cocoa apps

2014-04-30 Thread Costas Chatzinikolas
I am just experimenting with networking. I am trying to build small apps to
get the inside.
I firtsly thougth that Distributed Objects and remote procedure calling was
the more elegant way
to communicate over a LAN.

Then i found that Distributed Objects won't work on iOS. I am still in the
search before starting
my next small epxriment app.

And your opinions and experience are very valuable to me.

Thanks a lot !!!


2014-05-01 7:25 GMT+03:00 ChanMaxthon xcvi...@me.com:

 If you are targeting at remote procedure calling across Internet I have a
 library CGIJSONObjects that wraps REST-style JSON-based HTTP remote calls
 into objects. Server side language is not important. I used it to interface
 a server using Java servlets.

 Sent from my iPhone

  On May 1, 2014, at 4:04 AM, Gerd Knops gerti-cocoa...@bitart.com
 wrote:
 
 
  On Apr 30, 2014, at 2:39 PM, Jens Alfke j...@mooseyard.com wrote:
 
  Yes. DO between computers (over TCP) was never really supported on OS X,
 
  It most certainly was supported, and useable on a LAN (and even on a WAN
 over VPN, did not try it in the wild).
 
  and has a number of security and reliability problems
 
  True.
 
  that would make it a really bad idea for any real-world use.
 
  For the right context (non-mission critical convenience functionality,
 for example on top of zero-conf service discovery) it was (is?) a useable
 solution.
 
  Gerd
 
 
  ___
 
  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
  Please do not post admin requests or moderator comments to the list.
  Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
  Help/Unsubscribe/Update your Subscription:
  https://lists.apple.com/mailman/options/cocoa-dev/xcvista%40me.com
 
  This email sent to xcvi...@me.com
 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:

 https://lists.apple.com/mailman/options/cocoa-dev/costas.chatzinikolas%40gmail.com

 This email sent to costas.chatziniko...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Problem with distributed objects in GUI cocoa apps

2014-04-23 Thread Costas Chatzinikolas
Hi everyone,

i recently made a set of 2 command lines apps in Cocoa, that use
Distributed objects to communicate. In fact, the first app is the client
that sends a message, the second app is the server the vends the object.
Everything works ok!!!

Then i tried to make these 2 apps GUI based. I used the same code. The
server vends the object, but the client is unable to get the connection. It
always gets a nil connection. In fact when i check the number of available
connections from the client using:

[NSConnection allConnections]

it always return zero connections. The only difference in my code is that
in the GUI server app, i don't use:

[[NSRunLoop currentRunLoop] run]

since the GUI app has its own runLoop.

I also have enabled the sandbox networking capabilities for both GUI apps.

Has anyone experience this behavior before me?

Thanks in advance...
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Problem with distributed objects in GUI cocoa apps

2014-04-23 Thread Charles Srstka
On Mar 30, 2014, at 3:28 AM, Costas Chatzinikolas 
costas.chatziniko...@gmail.com wrote:

 Hi everyone,
 
 i recently made a set of 2 command lines apps in Cocoa, that use
 Distributed objects to communicate. In fact, the first app is the client
 that sends a message, the second app is the server the vends the object.
 Everything works ok!!!
 
 Then i tried to make these 2 apps GUI based. I used the same code. The
 server vends the object, but the client is unable to get the connection. It
 always gets a nil connection. In fact when i check the number of available
 connections from the client using:
 
 [NSConnection allConnections]
 
 it always return zero connections. The only difference in my code is that
 in the GUI server app, i don't use:
 
 [[NSRunLoop currentRunLoop] run]
 
 since the GUI app has its own runLoop.
 
 I also have enabled the sandbox networking capabilities for both GUI apps.
 
 Has anyone experience this behavior before me?
 
 Thanks in advance...

Distributed Objects is pretty old and crusty at this point. You might want to 
look into NSXPCConnection instead, which fixes a lot of problems that DO had, 
and is likely to be better supported.

Charles


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

problem with distributed objects

2010-02-15 Thread Eric Smith
OK, I'm back.

I have some distributed object code that used to work just great (back in the 
Tiger days, I think), and now does not.  I see the error: [NSPortCoder 
sendBeforeTime:sendReplyPort:] timed out, when I try to get the rootProxy from 
a connection.  I see this mentioned here and there on various mailing lists, 
but haven't seen any solution. 

I need to provide a DO across a network.  The simple code Apple provides in the 
DO programming guide does work on a single machine:

vend it
/* Assume serverObject has a valid value of an object to be vended. */
NSConnection *theConnection;
 
theConnection = [NSConnection defaultConnection];
[theConnection setRootObject:serverObject];
if ([theConnection registerName:@server] == NO) {
/* Handle error. */
}

get it
id theProxy;
theProxy = [[NSConnection
rootProxyForConnectionWithRegisteredName:@server
host:nil] retain];
[theProxy setProtocolForProxy:@protocol(ServerProtocol)];



But if one initializes the connection with an NSSocketPort, which is required 
if one wants to talk beyond a single machine, the registerName message fails.  
So, I whip out the code that used to work.  The few relevant parts listed below:

vend it:

conduitPort = [[NSSocketPort alloc] init];
myConduit = [[ServerConduit alloc] init];
conduitConnection = [[NSConnection alloc] initWithReceivePort:conduitPort 
sendPort:nil];
[conduitConnection setRootObject:myConduit];

get it:
- (void)netServiceDidResolveAddress:(NSNetService *)netService{
struct sockaddr *address;

NSConnection* theConnection;
NSSocketPort* thePort;
NSSocketPort* socket;
printf(\resolved address\n);
socket = [[NSSocketPort alloc] init];
if([[netService addresses] count]  0){
address = (struct sockaddr *)[[[netService addresses] 
objectAtIndex:0] bytes];
thePort = [[NSSocketPort alloc] 
initRemoteWithProtocolFamily:address-sa_family socketType:SOCK_STREAM 
protocol:0 address:[[netService  addresses] 
objectAtIndex:0]];
theConnection = [[NSConnection alloc] initWithReceivePort:nil 
sendPort:thePort];
[thePort release];
id theProxy = [theConnection rootProxy];
}else{
NSLog(@Could not find an address for the service.);
}
}


When I call rootProxy, I get the time out error.  Does anyone have a 
dirt-simple sample app I can look at that vends, and gets, a DO over a network 
on 10.5 or later?!  

Thanks for the help,
Eric

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com