Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Soulstorm

macrumors 68000
Original poster
Feb 1, 2005
1,887
1
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.

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 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?
 

Attachments

  • Original Example.zip
    35.1 KB · Views: 686
  • client test 2.zip
    18.9 KB · Views: 218

HiRez

macrumors 603
Jan 6, 2004
6,265
2,630
Western US
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

macrumors 68000
Original poster
Feb 1, 2005
1,887
1
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

macrumors 603
Jan 6, 2004
6,265
2,630
Western US
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

macrumors 68000
Original poster
Feb 1, 2005
1,887
1
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!!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.