• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting Up Socket Streams
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Setting Up Socket Streams (From: StaS Bandol <email@hidden>)

  • Prev by Date: Re: importing sqlite data into a core data "database"
  • Next by Date: Problem on reload data source of a table view
  • Previous by thread: Re: Setting Up Socket Streams
  • Next by thread: Re: Setting Up Socket Streams
  • Index(es):
    • Date
    • Thread