Re: Setting Up Socket Streams
Re: Setting Up Socket Streams
- Subject: Re: Setting Up Socket Streams
- From: Jens Alfke <email@hidden>
- Date: Sat, 12 Jul 2008 22:21:57 -0700
On 12 Jul '08, at 5:22 PM, StaS Bandol wrote:
but my 192.168.1.1 still not recieve nothing...
where i'm wrong?
That's because you didn't write anything to the streams. You just
opened and scheduled them. You need to wait for the streams to finish
opening them, then write to the output stream.
NSInputStream *iStream = [NSString stringWithFormat:@"ping"];
NSOutputStream *oStream = [NSString stringWithFormat:@"ping"];
[NSStream getStreamsToHost:host port:8000 inputStream:&iStream
outputStream:&oStream];
This code doesn't make any sense. First you're assigning values of the
wrong type to the pointers (which surely produced a compiler warning,
and you should pay attention to those). Then when you called NSStream
it simply overwrote those pointers with the pointers to the streams it
opened. You really need to read the documentation for +[NSStream
getStreamsToHost:], as it doesn't behave the way you seem to think it
does...
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden