ETSocket documentation

Authors

Generated by builder

Contents -

  1. Software documentation for the ETListenSocket class
  2. Software documentation for the ETSocket class
  3. Software documentation for the NSObject(ETListenSocketDelegate) informal protocol
  4. Software documentation for the NSObject(ETSocketDelegate) informal protocol
  5. Software documentation for the ETSocketFilter protocol
  6. ETSocket variables

Software documentation for the ETListenSocket class

ETListenSocket : ETSocket

Declared in:
ETSocket.h

@group Network and Communication


Instance Variables

Method summary

listenSocketForAddress: onPort: 

+ (id) listenSocketForAddress: (NSString*)anAddress onPort: (unsigned short)aPort;

Returns a socket listening on aPort for the address specified by anAddress.


listenSocketOnPort: 

+ (id) listenSocketOnPort: (unsigned short)aPort;

Returns a socket listening aPort for an address of the local machine.


initForAddress: onPort: 

- (id) initForAddress: (NSString*)anAddress onPort: (unsigned short)aPort;

Initializes the socket to listen on aPort for the address specified by anAddress.


initOnPort: 

- (id) initOnPort: (unsigned short)aPort;

Initializes the socket to listen on aPort for an address of the local machine.


initWithSocketAddress: 

- (id) initWithSocketAddress: (NSData*)socketAddress;

Initializes a listening socket with the contents of a sockaddr_* structure encapsulated in the NSData object socketAddress.




Instance Variables for ETListenSocket Class

hasAccept

@protected BOOL hasAccept;

Tracks whether the socket is already accepting connections.





Software documentation for the ETSocket class

ETSocket : NSObject

Declared in:
ETSocket.h

@group Network and Communication

The ETSocket class provides a simple wrapper around a socket. The socket is opened when the object is created, and closed when it is destroyed.


Instance Variables

Method summary

socketConnectedToRemoteHost: forService: 

+ (id) socketConnectedToRemoteHost: (NSString*)aHost forService: (NSString*)aService;

Returns a new socket connected to the specified host, with the specified service name on the first protocol to respond.


negotiateSSL 

- (BOOL) negotiateSSL;

Negotiates an SSL (client) connection. Returns YES on success.


sendData: 

- (void) sendData: (NSData*)data;

Sends the specified data through the socket. Throw ETSocketException if sending failed.


setDelegate: 

- (void) setDelegate: (id)aDelegate;

Sets the delegate.




Instance Variables for ETSocket Class

buffer

@protected unsigned char buffer;

Buffer used for receiving data.


delegate

@protected id delegate;

Reference to the delegate.


handle

@protected NSFileHandle* handle;

File handle encapsulating the socket. Used for runloop integration.


inFilters

@protected NSMutableArray* inFilters;

Array of filters used for filtering the input.


outFilters

@protected NSMutableArray* outFilters;

Array of filters used for filtering the output.


ssl

@protected void* ssl;

OpenSSL context.


sslContext

@protected void* sslContext;

OpenSSL context.





Software documentation for the NSObject(ETListenSocketDelegate) informal protocol

NSObject(ETListenSocketDelegate)

Declared in:
ETSocket.h

@group Network and Communication

Informal protocol for delegates to listening sockets.

Method summary

newConnection: fromSocket: 

- (void) newConnection: (ETSocket*)aSocket fromSocket: (ETSocket*)listenerSocket;

Handle a new connection request received by listenerSocket.


Software documentation for the NSObject(ETSocketDelegate) informal protocol

NSObject(ETSocketDelegate)

Declared in:
ETSocket.h

@group Network and Communication

Informal protocol for socket delegates.

Method summary

receivedData: fromSocket: 

- (void) receivedData: (NSData*)aData fromSocket: (ETSocket*)aSocket;

Handle data received over the specified socket.


Software documentation for the ETSocketFilter protocol

ETSocketFilter

Declared in:
ETSocket.h

@group Network and Communication

Protocol for socket data filters. Data sent or received by an ETSocket instance will be pushed through a chain of filters conforming to this protocol.

Method summary

filterData: 

- (NSMutableData*) filterData: (NSMutableData*)aData;

Filter the data and return the result. The caller must not retain a reference to the argument; filters are permitted to modify the data in-place and return the argument.


ETSocket variables

ETSocketException

NSString* ETSocketException;

Exception thrown on abrupt termination.