FROM : Shawn Erickson
DATE : Thu Aug 03 20:11:28 2006
On 8/3/06, Andrei Tchijov <<email_removed>> wrote:
> It looks like
>
> +[ NSStream (void)getStreamsToHost:(NSHost *)host port:(int)port
> inputStream:(NSInputStream **)inputStream outputStream:
> (NSOutputStream **)outputStream ]
>
> works slightly different on Intel, compare to PowerPC. On PowerPC,
> when this method fails, it will set inputStream/outputStream to nil.
> It looks like on Intel, in case of failure, it leaves inputStream/
> outputStream untouched.
>
> Does it sound right, or am I hallucinating?
The docs don't state what will happen to inputStream and outputStream
in the event of a failure (to bad it isn't stated). So you can't
safely depend on what the implementation will do since it isn't
specified. In a situation like that I would initialize them to nil
before sending that message.
Additionally I would query the status of the returned stream to
validate the state is as you expect (see -[NSStream streamStatus]).
-Shawn
DATE : Thu Aug 03 20:11:28 2006
On 8/3/06, Andrei Tchijov <<email_removed>> wrote:
> It looks like
>
> +[ NSStream (void)getStreamsToHost:(NSHost *)host port:(int)port
> inputStream:(NSInputStream **)inputStream outputStream:
> (NSOutputStream **)outputStream ]
>
> works slightly different on Intel, compare to PowerPC. On PowerPC,
> when this method fails, it will set inputStream/outputStream to nil.
> It looks like on Intel, in case of failure, it leaves inputStream/
> outputStream untouched.
>
> Does it sound right, or am I hallucinating?
The docs don't state what will happen to inputStream and outputStream
in the event of a failure (to bad it isn't stated). So you can't
safely depend on what the implementation will do since it isn't
specified. In a situation like that I would initialize them to nil
before sending that message.
Additionally I would query the status of the returned stream to
validate the state is as you expect (see -[NSStream streamStatus]).
-Shawn






Cocoa mail archive

