aeruder@ksu.edu
)Version: Revision 1
Date: November 8, 2003
Copyright: (C) Andrew Ruder
- Declared in:
- NetBase.h
- Conforms to:
- RunLoopEvents
NetApplication is the workhorse of netclasses. It manages all the connections and ports by inserting them into the runloop and calling the callback methods when appropriate. NetApplication is a singleton class; i.e. only one is in existence at a time. For this reason, always use +sharedInstance to get the appropriate instance.
Method summaryReturns the instance of NetApplication for the current application.
Calls -disconnectObject: on every object currently in the runloop.
Inserts anObject into the runloop (and
retains it). anObject should implement
either the
<NetPort>
or
<NetObject>
protocols. Throws a
NetException
if the class follows
neither protocol. After connecting
anObject, it will begin to receive the
methods designated by its respective protocol.
anObject should only be connected with
this after its transport is set.
Removes anObject from the runloop and releases it. anObject will no longer receive messages outlined by its protocol. Does not close the descriptor of anObject. anObject will receive a [<NetObject>-connectionLost] message or a [<NetPort>-connectionLost] message.
If any object should lose its connection, this will automatically be called with that object as its argument.
Should not be called. Used internally by NetApplication to receive events from the runloop.
Should not be called. Used internally by NetApplication to receive timed out events notifications from the runloop.
This is called to notify NetApplication that
aTransport has data that needs to be
written out. Only after this method is called will
aTransport begin to receive
[<NetTransport>-writeData:]
messages with a nil
argument when it can write.
- Declared in:
- NetBase.h
- Conforms to:
- NSObject
This protocol should be implemented by an object used in a connection. When a connection is received by a <NetPort> , the object attached to the port is created and given the transport.
Method summaryCalled when a connection has been established, and gives the object the transport used to actually transport the data. aTransport will implement <NetTransport> .
Called when [NetApplication -disconnectObject:] is called with this object as a argument. This object will no longer receive data or other messages after it is disconnected.
data is data read in from the connection.
Should return the transport given to the object by -connectionEstablished:
- Declared in:
- NetBase.h
- Conforms to:
- NSObject
Represents a class that acts as a port. Each port allows a object type to be attached to it, and it will instantiate an object of that type upon receiving a new connection.
Method summaryShould close the file descriptor.
Called when the object has [NetApplication -disconnectObject:] called on it.
Returns the low-level file descriptor.
Called when a new connection has been detected by NetApplication . The port should should use this new connection to instantiate a object of the class set by -setNetObject: .
Sets the class of the object that should be attached to the port. This class should implement the <NetObject> protocol.
- Declared in:
- NetBase.h
- Conforms to:
- NSObject
A protocol used for the actual transport class of a connection. A transport is a low-level object which actually handles the physical means of transporting data to the other side of the connection through methods such as -readData: and -writeData: .
Method summaryShould close the file descriptor.
Returns a file descriptor representing the connection.
Return YES
if no more data is waiting
to be written, and NO
otherwise. Used by
NetApplication
to determine when it can stop checking the transport
for writing availability.
Returns an object representing the local side of a connection. The actual object depends on the implementation of this protocol.
Called by NetApplication when it is safe to write. Should return data read from the connection with a maximum size of maxReadSize.
Returns an object representing the remote side of a connection. The actual object depends on the implementation of this protocol.
This should serve two purposes. When data
is not nil
, the transport should store the
data, and then call
[NetApplication -transportNeedsToWrite:]
to notify
NetApplication
that the transport needs to write. When
data is nil
, the transport
should assume that it is actually safe to write
the data and should do so at this time.
NetApplication
will call
-writeData:
with a nil
argument when it is safe
to write
- Declared in:
- NetBase.h
Used for OS X compatibility. OS X does not have the RunLoopEvents protocol. This is a GNUstep-specific extension. This must be recreated on OS X to compile netclasses.
Method summaryOS X compatibility function. This is a callback called by the run loop when an event has been received.
OS X compatibility function. This is a callback called by the run loop when an event has timed out.
Used for OS X compatibility. This type is an extension to GNUstep. On OS X, a compatibility layer is created to recreate the GNUstep extensions using OS X extensions.
Should be thrown when a non-recoverable exception occurs on a connection. The connection should be closed immediately.
Thrown when a recoverable exception occurs on a connection or otherwise.