PDA

View Full Version : Cocoa Distributed Objects Help With Simple Problem




Soulstorm
Dec 25, 2006, 12:01 PM
First of all, Merry Christmas.

I am making my first steps in Cocoa Networking, and I am trying to figure out distributed objects. I have the Cocoa Programming book, and I have found a simple example of distributed objects. (http://att.macrumors.com/attachment.php?attachmentid=64746&stc=1&d=1167069586)

The task is simple. The DOTest is a simple server. The DOTestClient is a client that connects to this server. Multiple clients can connect to the server. So, these clients can chat with each other, provided that they are connected to the server. I give you the original example (client and server), from the book, that works perfectly.

I tried to make the client on my own. I made the EXACT SAME things, and I have the exact same code, only that... nothing happens! I also give you the client that I made (http://att.macrumors.com/attachment.php?attachmentid=64746&stc=1&d=1167069586) following the example. My client does not even execute the code that resides in the -applicationDidFinishLaunching function. I have set the file as delegate of the first responder. I would be grateful if anyone has a look at it and finds out what's wrong. I am obviously missing something.

Can anyone tell me why my client doesn't work, since it has the same code and the same IB outlet connections as the example set by the book?



HiRez
Dec 25, 2006, 02:49 PM
I ran your code and it seems to be working perfectly, although I can't tell if the message is getting through from client to client because I can only run one instance of the client on my machine. But the client does connect to the server, applicationDidFinishLaunching: is getting called, and a non-nil server is assigned to the variable. The server reports a successful connection, and the messages I send are showing up in the top pane after I send them (although they need some sort of separator, a newline at least).

Soulstorm
Dec 26, 2006, 03:36 PM
I ran your code and it seems to be working perfectly, although I can't tell if the message is getting through from client to client because I can only run one instance of the client on my machine. But the client does connect to the server, applicationDidFinishLaunching: is getting called, and a non-nil server is assigned to the variable. The server reports a successful connection, and the messages I send are showing up in the top pane after I send them (although they need some sort of separator, a newline at least).

Actually, you can run two or more instances, if you open the application through the terminal. Can you try that?

HiRez
Dec 27, 2006, 03:44 AM
Actually, you can run two or more instances, if you open the application through the terminal. Can you try that?Yep, it is working (you have to run the actual executable inside the package to run two at once, "open" will not work). Both clients connect and can see what either one types (and they correctly report when another client connects). So, it looks like something is up with your specific system if it's not working for you. I am running 10.4.8 if that makes a difference.

Soulstorm
Dec 27, 2006, 04:32 AM
Well, I found out what was wrong. Seems it was a permission problem. Repaired permissions and worked fine. Thanks a lot, HiRea, and sorry for wasting your time!!