• 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
NSHost and NSStream question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSHost and NSStream question


  • Subject: NSHost and NSStream question
  • From: Mathieu Coursolle <email@hidden>
  • Date: Thu, 21 Jan 2010 09:43:40 -0500

Hi Cocoa developers,

I am writing a small application that acts as a TCP client for another application (TCP server).
The client nows the IP address and port of the server. I then use NSStream to create an output
stream from an NSHost (see code bellow).

If I initialize the IP address as 127.0.0.1, or my own 192.168.1.x address, it creates the NSHost and
NSOutputStream properly, but I always get a connection refused error.

Does anybody see what I am doing wrong here ?

Thanks!
Mathieu

NSHost* host = [NSHost hostWithAddress:@"127.0.0.1"];
[NSStream getStreamsToHost:host port:5000 inputStream:nil outputStream:&outputStream];
[self setOutputStream:outputStream];
[outputStream setProperty:NSStreamSocketSecurityLevelNegotiatedSSL
		   forKey:NSStreamSocketSecurityLevelKey];
[outputStream setDelegate:self];
[outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[outputStream open];_______________________________________________

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: NSHost and NSStream question
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: initialize a store with default data core data
  • Next by Date: Re: Bindings: NSMutableArray -> NSArrayController -> NSPopUp
  • Previous by thread: Re: initialize a store with default data core data
  • Next by thread: Re: NSHost and NSStream question
  • Index(es):
    • Date
    • Thread