portForName:host:
ポート名とホスト名でポートを返します
-(NSPort *)portForName:(NSString *)portName:
host:(NSString *)hostName:
解説
ポート名とホスト名でポートを返します。
返り値
( NSPort * )
ポート
引数
( NSString * )portName
ポート名
( NSString * )hostName
ホスト名
フレームワーク
Foundation
クラス
NSSocketPortNameServer
Instance Methods
使用可能
10.0
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { //id server; NSSocketPort *port2; NSSocketPort *port = [[NSSocketPort alloc] initRemoteWithTCPPort:80 host:@"www.oomori.com" ]; //NSConnection *connection = [NSConnection connectionWithReceivePort:nil sendPort:port]; NSSocketPortNameServer *spns = [NSSocketPortNameServer sharedInstance]; ([spns registerPort:port name:@"www.oomori.com" nameServerPortNumber:6 ]) ? NSLog(@"YES") : NSLog(@"NO"); port2 = [spns portForName:@"www.oomori.com" host:@"" ]; NSLog ([NSString stringWithFormat:@"%d",[port protocol]]); NSLog ([port2 description]); } @end