• 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
Setting Up Socket Streams
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting Up Socket Streams


  • Subject: Setting Up Socket Streams
  • From: StaS Bandol <email@hidden>
  • Date: Sun, 13 Jul 2008 02:22:08 +0200

Hi all,

I have a basic(for most of you) question.
I´m trying to make a very simple app that will have 1 button (for example) and when its pushed the app will create a socket connection with a host and will send it a message(command).


So , i used this:

- (IBAction)reset:(id)sender
{
    [textField setStringValue:@"Testing Socket"];



	NSString *urlStr = [sender stringValue];
    if (![urlStr isEqualToString:@""]) {

        NSURL *website = [NSURL URLWithString: @"http://192.168.1.2";];
        if (!website) {
            NSLog(@"%@ is not a valid URL");
            return;
        }
		NSHost *host = [NSHost hostWithName:@"http://192.168.1.2";];
		NSInputStream *iStream = [NSString stringWithFormat:@"ping"];
		NSOutputStream *oStream = [NSString stringWithFormat:@"ping"];
        [NSStream getStreamsToHost:host port:8000 inputStream:&iStream
					  outputStream:&oStream];
        [iStream retain];
	    [oStream retain];
        [iStream setDelegate:self];
        [oStream setDelegate:self];
        [iStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
	   				   forMode:NSDefaultRunLoopMode];
        [oStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
	   				   forMode:NSDefaultRunLoopMode];
        [iStream open];
        [oStream open];
    }


}



@end




but my 192.168.1.1 still not recieve nothing... where i'm wrong?

Any help will be appreciated.
Thank you!

_______________________________________________

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


  • Follow-Ups:
    • Re: Setting Up Socket Streams
      • From: Jens Alfke <email@hidden>
    • Re: Setting Up Socket Streams
      • From: Chris Hanson <email@hidden>
  • Prev by Date: importing sqlite data into a core data "database"
  • Next by Date: Re: importing sqlite data into a core data "database"
  • Previous by thread: Re: importing sqlite data into a core data "database"
  • Next by thread: Re: Setting Up Socket Streams
  • Index(es):
    • Date
    • Thread