Setting Up Socket Streams
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