Re: Odd DO Problem...
Re: Odd DO Problem...
- Subject: Re: Odd DO Problem...
- From: Chris Kane <email@hidden>
- Date: Sun, 25 Jan 2004 16:10:15 -0800
On Jan 25, 2004, at 7:09 AM, Dave Keck wrote:
I'm writing a client/server that uses distributed objects and works
over TCP. I'm using unsigned char arrays to send data (specifically,
images), but I've run into a nasty problem.
Whenever there's a byte that's assigned 0 in the unsigned char array,
the DO system thinks that's the end of the unsigned char array,
causing
all the data after the 0 to be gibberish. One way I've thought of
getting around this problem is setting all the 0's to 1's and then
sending another array telling what indexes need to be changed from 1
to
0. This would allow the data to be sent to the client, and the client
would change all the necessary 1's to 0's.
Although this would probably work, it would cause the application to
slow down, and it seems like a fairly large work-around.
Is there another/a better way of sending data, that will accept 0's?
I
tried encapsulating the data into an NSData object awhile back, but I
don't remember it working...
Why not sending an NSArray containing NSNumbers?
I'm really looking for optimum speed, and the NSArray would have to
have 200000+ elements. I think using an unsigned char is probably the
fastest method if I could get it to work. But nonetheless I will try
using an NSArray.
char * means C string to DO. The declaration is ambiguous in C, and DO
chooses the C string meaning. The thing to do is wrap the bytes in an
NSData (should be able to use the no-copy variant on the sending side)
and send that.
Chris Kane
Cocoa Frameworks, Apple
_______________________________________________
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.