Re: Sending objects using sockets and NSFileHandles....
Re: Sending objects using sockets and NSFileHandles....
- Subject: Re: Sending objects using sockets and NSFileHandles....
- From: Wade Tregaskis <email@hidden>
- Date: Sat, 1 Nov 2003 10:45:19 +1100
I'm working with some sockets and file handles for the first time, and
I want to send an image across a network, would this be an appropriate
way to do it (conceptually):
1. Client sends string message "image" to server (using writeData:)
2. Server receives string data "image", and so sends image as data
(using writeData:)
3. Client now receives image data and converts it to an NSImage.
Is this the appropriate way to send images and other objects? Or is
there a more conventional method.
You may be able to just use Distributed Objects for this. Using DO,
you would set up your server to listen on a TCP port (using
NSSocketPorts), then connect with the client, and simply request the
image from the server using a normal ObjC method, e.g. "-
(NSImage*)image;". This automagically handles all the serialization
issues, and lets you focus on high order design issues, rather than the
technical details.
<blatant self promotion>
If security is an issue, I've built an NSPort subclass you can use
instead of NSSocketPort, which integrates SecureTransport (SSL/TLS).
You can grab it from <
http://www.sourceforge.net/projects/securedo/>.
</promotion>
Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
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.