Re: Client / Server Application
Re: Client / Server Application
- Subject: Re: Client / Server Application
- From: Jeff LaMarche <email@hidden>
- Date: Mon, 15 Oct 2001 21:34:19 -0700
On Monday, October 15, 2001, at 06:55 PM, Sam Goldman wrote:
What docs, examples, etc. do I need to look at to make a client/server
application with Cocoa. I need info on (as far as I can guess) getting a
port number, and connecting to other computers with it.
This is certainly outside of my area of expertise, but I'll provide what
I can. One of the many nice things about objective-C is that you can use
everything that would be available to you in C. So, to do a custom
client/server application, you could program to the metal and program to
the sockets. Or you could utilize the Cocoa classes NSConnection,
NSPort, etc. to establish communications, even using DO to simplify the
programming - if you are going to be programming ONLY for OS X clients
and servers. You could use the Java bridge to use some of Java's
functionality. I don't recommend the Java bridge except for prototyping
(because there are a lot more Java classs and examples available, so if
you're in a hurry, you're more likely to find a Java class that does
what you need), but Java does have some classes that make writing a
client/server application pair considerably easy and gamelan.com has a
series of tutorial showing how to do it. There are probably other
options (Berkeley sockets?) available, so you need to, I think, define
your needs a little better before deciding how to proceed. Do you need
cross platform support? Is portability or readability of code more
important?
I don't know of an objective-C client-server example, but I'm sure there
are some available. You should start by getting a foundation by reading
the documentation for NSConnection and NSPort and related classes if you
think you'll go that route.
Some examples right on your machine that are not directly on-topic, but
which will help you understand inter-app communications in Cocoa:
/Developer/Examples/Foundation/Authenticator
/Developer/Examples/Foundation/MultiThreadedDO
/Developer/Examples/Foundation/ForwardInvocation
Hmmm... I hope someone throws out some useful information because I feel
like I'm rambling... =)
It'll start out as a chatting program, but I want it to be
fully-featured by
the end.
I have never made a program like this before, but I'd like to learn this
kind of stuff.