• 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
NSStream proxy weirdness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSStream proxy weirdness


  • Subject: NSStream proxy weirdness
  • From: Scott Mitchell <email@hidden>
  • Date: Fri, 7 Jan 2005 13:39:55 -0700

I am sending this for a co-worker of mine does anyone have any ideas?

-------------------------

I am creating a network client and wanted to include SOCKS5 proxy support. I was excited to discover that NSStream has support for it and I don't have to do much at all. But I can't seem to get it to work. For purposes of unit testing, I've created a class of my own called J3Stream that is just a wrapper around NSStream. It has this method:

- (BOOL) setProperty:(id)value forKey:(NSString *)key
{
BOOL success = NO;
NSLog(@"Success: %d\nValue before set: %@\nKey: %@", success, value, key);
success = [stream setProperty:value forKey:key];
NSLog(@"Success: %d\nValue after set: %@\nKey: %@",
success, [stream propertyForKey:key], key);
return success;
}

That gets called elsewhere in my code with a dictionary full of the settings the NSStream documentation says I need to pass in. Here's a copy of the log when I do that (passwords and the like have been changed to protect the innocent):

----- BEGIN LOG -----
2005-01-07 14:15:05.130 Koan[16093] Success: 0
Value before set: <CFDictionary 0x344e40 [0xa01900e0]>{type = immutable, count = 5, capacity = 5, pairs = (
0 : <CFString 0xa09f69a0 [0xa01900e0]>{contents = "kCFStreamPropertySOCKSPassword"} = <CFString 0x344ca0 [0xa01900e0]>{contents = "password"}
1 : <CFString 0xa09f6978 [0xa01900e0]>{contents = "kCFStreamPropertySOCKSVersion"} = <CFString 0xa09f69c8 [0xa01900e0]>{contents = "kCFStreamSocketSOCKSVersion5"}
3 : <CFString 0xa09f698c [0xa01900e0]>{contents = "kCFStreamPropertySOCKSUser"} = <CFString 0x344c90 [0xa01900e0]>{contents = "samuel"}
4 : <CFString 0xa09f6950 [0xa01900e0]>{contents = "kCFStreamPropertySOCKSProxyHost"} = <CFString 0x344c70 [0xa01900e0]>{contents = "elysium.arete.cc"}
8 : <CFString 0xa09f6964 [0xa01900e0]>{contents = "kCFStreamPropertySOCKSProxyPort"} = <CFNumber 0x344da0 [0xa01900e0]>{value = +1080, type = kCFNumberSInt32Type}
)}
Key: kCFStreamPropertySOCKSProxy

2005-01-07 14:15:05.165 Koan[16093] Success: 1
Value after set: (null)
Key: kCFStreamPropertySOCKSProxy
----- END LOG -----

The source of my confusion is that NSStream -setProperty:forKey: returns YES to indicate that the property was successfully set, yet it clearly was not. This happens on both the input and output stream. I'm creating these streams using NSStream +getStreamsToHost:port:inputStream:outputStream:, but I ensure that the property is set prior to the streams being opened. And I would expect that it would return a status of NO if it couldn't set them.

Any ideas?

-- Samuel


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: How can I right-justify items in an NSPopUpButton?
  • Next by Date: Re: Drawing scaled lines
  • Previous by thread: Re: image drawing glitch
  • Next by thread: Bindings & Undo - Nevermind
  • Index(es):
    • Date
    • Thread