Mark Slee | 77575e6 | 2007-09-24 19:24:53 +0000 | [diff] [blame] | 1 | #import <Cocoa/Cocoa.h> |
| 2 | #import "TSocketClient.h" |
| 3 | |
| 4 | @implementation TSocketClient |
| 5 | |
| 6 | - (id) initWithHostname: (NSString *) hostname |
| 7 | port: (int) port |
| 8 | { |
| 9 | NSInputStream * input = nil; |
| 10 | NSOutputStream * output = nil; |
| 11 | |
| 12 | [NSStream getStreamsToHost: [NSHost hostWithName: hostname] |
| 13 | port: port |
| 14 | inputStream: &input |
| 15 | outputStream: &output]; |
| 16 | |
Mark Slee | 8440605 | 2007-11-20 01:39:25 +0000 | [diff] [blame] | 17 | self = [super initWithInputStream: input outputStream: output]; |
| 18 | [input open]; |
| 19 | [output open]; |
| 20 | |
| 21 | return self; |
Mark Slee | 77575e6 | 2007-09-24 19:24:53 +0000 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | |
| 25 | @end |
| 26 | |
| 27 | |
| 28 | |