Re: Sample Code
Re: Sample Code
- Subject: Re: Sample Code
- From: "M. Uli Kusterer" <email@hidden>
- Date: Mon, 22 Sep 2003 20:51:55 +0200
At 19:49 Uhr +0200 22.09.2003, Matis Schotte wrote:
no - i mean over sockets ...
The most convenient way to do sockets these days is to create a
socket using Unix APIs and then pass the file descriptor to
NSFileHandle. Then you can use the NSFileHandle to easily read/write
your data.
i will create a client/server application that sends an receives
files or directories and therefor to display the status ...
this is only programmaticable over sockets ...?
Are you inventing your own protocol? Or do you want to implement an
existing protocol? If the latter, just look at the RFC for the
protocol you want to implement. They're surprisingly
comprehensibly-written pieces of text, and it's very easy to send FTP
or SMTP commands across using NSString's dataWithEncoding (or
something like that) method to turn it into ASCII for the commands.
If you're doing your own protocol, you can do whatever you want.
Usually, the easiest way is to model it after an existing protocol,
like FTP. You may have to BinHex files if you want the resource fork
or the file flags to come across intact, but there's sample code for
that on the net.
if all you want to do is upload/download from/to a server, you may
also be able to use other APIs. Carbon has URL Access
(URLSimpleUpload, URLSimpleDownload and a few others), so I guess
you'll find something equivalent in NSURL.h or a similar Cocoa header.
Google is your friend ;-) You can also find useful sample code for
the NSfileHandle/Unix socket trick at
http://cocoa.mamasam.com, and
there's a nifty FAQ for common Cocoa questions at
http://macosxguru.net.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.