Cocoa Distributed Objects Help With Simple Problem

Discussion in 'Mac Programming' started by Soulstorm, Dec 25, 2006.

  1. macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #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?
     

    Attached Files:

  2. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #2
    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).
     
  3. thread starter macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #3
    Actually, you can run two or more instances, if you open the application through the terminal. Can you try that?
     
  4. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #4
    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.
     
  5. thread starter macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #5
    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!!
     

Share This Page