FROM : Andrei Tchijov
DATE : Thu Aug 03 20:22:54 2006
Very true. It just that I got bitten by it (I did not assigned
initial values to in/out stream). Nowhere in the documentation it
mentions that you have to nil initial values in order to be able to
check success/failure. It looks little bit odd to me. Why this
method does not return some sort of status is quite beyond me.
To be fair, documentation does not promise that in/out stream
variables will be nil-ed on failure.
On Aug 3, 2006, at 2:04 PM, Sherm Pendley wrote:
> On Aug 3, 2006, at 1:37 PM, Andrei Tchijov 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.
>
> That sort of internal detail shouldn't make a difference in how you
> use this method.
>
> NSInputStream *inStream = nil;
> NSOutputStream *outStream = nil;
>
> [NSStream getStreamsToHost:someHost port:somePort
> inputStream:&inStream outputStream:&outStream];
>
> What effective difference can it possibly make whether
> +getStreams... method explicitly set either inStream or outStream
> to nil, or simply left the existing nil value alone? Either way the
> result will be the same - nil on failure.
>
> sherm--
>
> Web Hosting by West Virginians, for West Virginians: http://wv-www.net
> Cocoa programming in Perl: http://camelbones.sourceforge.net
>
>
DATE : Thu Aug 03 20:22:54 2006
Very true. It just that I got bitten by it (I did not assigned
initial values to in/out stream). Nowhere in the documentation it
mentions that you have to nil initial values in order to be able to
check success/failure. It looks little bit odd to me. Why this
method does not return some sort of status is quite beyond me.
To be fair, documentation does not promise that in/out stream
variables will be nil-ed on failure.
On Aug 3, 2006, at 2:04 PM, Sherm Pendley wrote:
> On Aug 3, 2006, at 1:37 PM, Andrei Tchijov 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.
>
> That sort of internal detail shouldn't make a difference in how you
> use this method.
>
> NSInputStream *inStream = nil;
> NSOutputStream *outStream = nil;
>
> [NSStream getStreamsToHost:someHost port:somePort
> inputStream:&inStream outputStream:&outStream];
>
> What effective difference can it possibly make whether
> +getStreams... method explicitly set either inStream or outStream
> to nil, or simply left the existing nil value alone? Either way the
> result will be the same - nil on failure.
>
> sherm--
>
> Web Hosting by West Virginians, for West Virginians: http://wv-www.net
> Cocoa programming in Perl: http://camelbones.sourceforge.net
>
>






Cocoa mail archive

