Re: Socket Blocking Question

2010-01-20 Thread Greg Guerin
Carter R. Harrison wrote: > The second way is to send a request and then let the NSInputStream call a > delegate method when the response data is available. The response data is > then pushed up through my protocol stack and finally up to the higher level > application code. The benefit t

Re: Socket Blocking Question

2010-01-20 Thread Steven Degutis
The only other danger of code injection with this solution (that I can think of!) lies in taking advantage of the requirement of all arguments needing to conform to NSCoder. Malicious data from a third party may disguise itself as an NSData in such a way as to cause some buffer overflow or somethin

Re: Socket Blocking Question

2010-01-20 Thread Steven Degutis
In my implementation of this solution, it is a slight danger of code injection, but only in the sense that *existing methods can be called with bunk data*. Methods that are not implemented by the protocol (and thus destination) are ignored when received over the network. However, this connection be

Re: Socket Blocking Question

2010-01-20 Thread nicolas berloquin
This is a genuine question/remark that pops up. No check is done on what selector or object is returned or is it ? If this is done on a public service (web server or other), couldn't code injection be too easilly done that way ? (easy hacking, wilfull crash etc) ? Le 20 janv. 2010 à 19:47,

Re: Socket Blocking Question

2010-01-20 Thread Steven Degutis
FWIW, that's exactly what AsyncSocket does, using delegate callbacks (pretty typical Cocoa pattern). This is one reason why I suggested it. On Wed, Jan 20, 2010 at 3:06 PM, nicolas berloquin wrote: > I may not have fully grasped your problem but you seem to say that getting > 'pieces' of the repl

Re: Socket Blocking Question

2010-01-20 Thread nicolas berloquin
I may not have fully grasped your problem but you seem to say that getting 'pieces' of the reply generates a lot of problems for you. Couldn't you have a socket that buffers the replies and that sends the whole aggregated messages to the rest of the app when done ? You could have a special 'mes

Re: Socket Blocking Question

2010-01-20 Thread Steven Degutis
Also, I still recommend using AsyncSocket instead of NSStream APIs as AsyncSocket will make your life much simpler at pretty much no cost. -Steven On Wed, Jan 20, 2010 at 11:39 AM, Carter R. Harrison wrote: > I need some folks experienced with cocoa and socket programming to weigh in > for me o

Re: Socket Blocking Question

2010-01-20 Thread Ken Thomases
On Jan 20, 2010, at 1:42 PM, Carter R. Harrison wrote: > On Jan 20, 2010, at 2:23 PM, Ken Thomases wrote: > >> If you're using lots of CPU time, then you're not blocking, you're spinning. >> When a thread is blocked, it does nothing and consumes no CPU time. >> >> Now, blocking is bad in the m

Re: Socket Blocking Question

2010-01-20 Thread Steven Degutis
By the way, supporting 10.5 isn't necessarily a problem for using Blocks. PLBlocks is a viable plugin for Xcode on 10.5 that allows you to use blocks. I can attest that it is pretty stable and I would use it in production apps if I had to use 10.5 and needed blocks for something like this. -Steven

Re: Socket Blocking Question

2010-01-20 Thread Carter R. Harrison
On Jan 20, 2010, at 2:23 PM, Ken Thomases wrote: > On Jan 20, 2010, at 11:39 AM, Carter R. Harrison wrote: > >> I need some folks experienced with cocoa and socket programming to weigh in >> for me on some design problems I've been having. I'm designing an >> application that acts as a client

Re: Socket Blocking Question

2010-01-20 Thread Carter R. Harrison
On Jan 20, 2010, at 1:40 PM, Steven Degutis wrote: > Recently I had the same issue you were having, sort of. And I came up with a > solution I really liked. > > When I was playing with Distributed Objects, I fell in love with the abstract > simplicity. However, it blocks and that's bad. It's e

Re: Socket Blocking Question

2010-01-20 Thread Ken Thomases
On Jan 20, 2010, at 11:39 AM, Carter R. Harrison wrote: > I need some folks experienced with cocoa and socket programming to weigh in > for me on some design problems I've been having. I'm designing an > application that acts as a client in a client-server model. The client > communicates wit

Re: Socket Blocking Question

2010-01-20 Thread Steven Degutis
Oops, correction: the downside is that all arguments and return values need to conform to NSCoder protocol. So, it's even more strict than I described earlier. But it's still cool :) -Steven On Wed, Jan 20, 2010 at 12:40 PM, Steven Degutis wrote: > Recently I had the same issue you were having,

Re: Socket Blocking Question

2010-01-20 Thread Steven Degutis
Recently I had the same issue you were having, sort of. And I came up with a solution I really liked. When I was playing with Distributed Objects, I fell in love with the abstract simplicity. However, it blocks and that's bad. It's even worse when the server stops responding, because you could pot