+/*!
+ * @enum ITInetSocketState
+ * @abstract Possible states of a socket
+ * @constant ITInetSocketConnecting The socket is negotiating a connection.
+ * @constant ITInetSocketListening The socket is a server socket.
+ * @constant ITInetSocketReading The socket is reading data from the other side.
+ * @constant ITInetSocketWriting The socket is sending data to the other side.
+ * @constant ITInetSocketDisconnected The socket does not have a connection.
+ */
+typedef enum {
+ ITInetSocketConnecting,
+ ITInetSocketListening,
+ ITInetSocketReading,
+ ITInetSocketWriting,
+ ITInetSocketDisconnected
+} ITInetSocketState;
+
+/*!
+ * @enum ITInetSocketError
+ * @abstract Possible error conditions of a socket
+ * @constant ITInetHostNotFound The host specified does not actually exist.
+ * @constant ITInetConnectionDropped The remote side dropped the connection.
+ * @constant ITInetCouldNotConnect The socket was unable to connect for some reason
+ */
+typedef enum {
+ ITInetHostNotFound,
+ ITInetConnectionDropped,
+ ITInetCouldNotConnect
+} ITInetSocketError;
+
+@class ITInetSocket;
+
+/*!
+ * @protocol ITInetSocketDelegate
+ * @abstract Delegate methods for ITInetSocket
+ * @discussion ITInetSockets use these methods to communicate with their delegates
+ */
+@protocol ITInetSocketDelegate <DataReciever>
+/*!
+ * @method errorOccured:during:onSocket:
+ * @abstract Alerts the delegate of an error condition.
+ * @discussion The delegate can try retryCondition.
+ * @param err The error class.
+ * @param state What the socket was doing when the error occured.
+ * @param sender The socket the error occured on.
+ */
+- (oneway void) errorOccured:(ITInetSocketError)err during:(ITInetSocketState)state onSocket:(ITInetSocket*)sender;
+/*!
+ * @method finishedConnecting:
+ * @abstract Alerts the delegate of a successful connection attempt.
+ * @discussion The delegate should send whatever initial data is required for the protocol (nickname for IRC, etc.)
+ * @param sender The socket that established the connection.
+ */
+- (oneway void) finishedConnecting:(ITInetSocket *)sender;
+@end
+
+/*!
+ * @class ITInetSocket
+ * @abstract An Internet socket class.
+ * @discussion ITInetSocket is an Internet socket class supporting IPv6 and Rendezvous.
+ */
+@interface ITInetSocket : NSObject <DataReciever> {
+ int sockfd;
+ int port;
+ int nc;
+ unsigned short bufs;
+ volatile int dieflag;
+ volatile int actionflag;
+ id <ITInetSocketDelegate> delegate;
+ struct addrinfo *ai, *ai_cur;
+ ITByteStream *readPipe, *writePipe;
+ ITInetSocketState state;
+ NSArray *sarr;