X-Git-Url: http://git.ithinksw.org/ITFoundation.git/blobdiff_plain/52cc5b84bdd910fe315c8a77dd8a9a5b0f6d0502..14a301f7aa7b244c4831006cfc4cfa42185517a4:/ITInetSocket.h diff --git a/ITInetSocket.h b/ITInetSocket.h index 2f25958..3eb0000 100755 --- a/ITInetSocket.h +++ b/ITInetSocket.h @@ -63,14 +63,14 @@ typedef enum { * @abstract Delegate methods for ITInetSocket * @discussion ITInetSockets use these methods to communicate with their delegates */ -@protocol ITInetSocketDelegate +@protocol ITInetSocketDelegate /*! - * @method dataRecieved: + * @method dataReceived: * @abstract Alerts the delegate of data. * @discussion The delegate should check [sender readPipe] to get the data. * @param sender The socket that the messages came from. */ -- (void) dataRecieved:(ITInetSocket *)sender; +- (void) dataReceived:(ITInetSocket *)sender; /*! * @method errorOccured:during:onSocket: * @abstract Alerts the delegate of an error condition. @@ -94,21 +94,50 @@ typedef enum { * @abstract An Internet socket class. * @discussion ITInetSocket is an Internet socket class supporting IPv6 and Rendezvous. */ -@interface ITInetSocket : NSObject { +@interface ITInetSocket : NSObject { @public + /*! + * @var sockfd + * @abstract KLWONZ + */ int sockfd; int port; - id delegate; + unsigned short bufs; + volatile int dieflag; + volatile int actionflag; + id delegate; struct addrinfo *ai, *ai_cur; ITByteStream *readPipe, *writePipe; ITInetSocketState state; NSArray *sarr; } -+(void)startAutoconnectingToService:(NSString*)type delegate:(id )d; --(id) initWithFD:(int)fd delegate:(id )d; --(id) initWithDelegate:(id )d; +/*! + * @method startAutoconnectingToService:delegate: + * @abstract Automatically creates sockets whenever a certain type of Rendezvous service appears. + * @discussion The auto-created sockets will send finishedConnecting: to the delegate. + * @param type The type of Rendezvous service to listen on. + * @param d The delegate that the sockets will belong to. + */ ++(void)startAutoconnectingToService:(NSString*)type delegate:(id )d; +/*! + * @method initWithFD:delegate: + * @abstract Wraps a socket around an existing socket descriptor. + * @discussion The socket will start listening on the descriptor as normal. + * @param fd The descriptor. + * @param d The delegate for the socket. + */ +-(id) initWithFD:(int)fd delegate:(id )d; +/*! + * @method initWithDelegate: + * @abstract Creates a new socket. + * @discussion The socket will not be connected to anything. + * @param d The delegate of the socket. + */ +-(id) initWithDelegate:(id )d; -(id )delegate; +-(unsigned short)bufferSize; +-(void)setBufferSize:(unsigned short)bufs; -(void) connectToHost:(NSString*)host onPort:(short)port; -(void) connectToHost:(NSString*)host onNamedPort:(NSString*)port; -(void) connectWithSockaddrArray:(NSArray*)arr;