Packagecom.electrotank.electroserver4.connection
Classpublic class AbstractConnection
InheritanceAbstractConnection Inheritance Observable
SubclassesConnection, HttpConnection

This class is used internally to the ElectroServer class. When you want to create a new connection use one of the connection functions on the ElectroServer object. This class is inherited by all Connection types to handle connection-related functions.



Public Methods
 MethodDefined by
  
AbstractConnection(ip:String, port:Number, protocol:String)
Creates a new instance of the AbstractConnection class.
AbstractConnection
 Inherited
addEventListener(mt:MessageType, funcName:String, scope:Object, first:Boolean = false):void
Observable
 Inherited
addListener(ob:Object):void
Observable
  
close():void
Closes the connection to the server.
AbstractConnection
  
connect():void
Attempts to connect to the ip and port specified.
AbstractConnection
 Inherited
dispatchEvent(eventOb:MessageImpl):void
Observable
  
Gets the next expected inbound id.
AbstractConnection
  
getId():Number
Gets the connection id.
AbstractConnection
  
getIp():String
Gets the ip used.
AbstractConnection
  
getIsConnected():Boolean
Returns true if connected, false if not.
AbstractConnection
  
Gets the next outbound id.
AbstractConnection
  
getPort():Number
Gets the port used.
AbstractConnection
  
getProtocol():String
Gets the connection protocol.
AbstractConnection
 Inherited
notifyListeners(eventName:String, eventOb:Object):void
Observable
  
onPreClose():void
Used internally to tell whoever is listening that a connection close is happening.
AbstractConnection
  
onPreConnect(success:Boolean):void
Used internally to send an event to whoever is listening.
AbstractConnection
 Inherited
removeEventListener(mt:MessageType, funcName:String, scope:Object):void
Observable
 Inherited
removeListener(ob:Object):void
Observable
  
send(message:String):void
Sends a message to the server.
AbstractConnection
  
sendBinary(ba:ByteArray):void
Sends a message to the server.
AbstractConnection
  
setExpectedInboundId(id:Number):void
Sets the next expected inbound id.
AbstractConnection
  
setId(id:Number):void
Sets the connection id.
AbstractConnection
Protected Methods
 MethodDefined by
  
doClose():void
Must be implemented in a new inherited class.
AbstractConnection
Constructor detail
AbstractConnection()constructor
public function AbstractConnection(ip:String, port:Number, protocol:String)

Creates a new instance of the AbstractConnection class.

Parameters
ip:String — The ip to connect to.
 
port:Number — The port to use.
 
protocol:String — The protocol to use.

See also

Method detail
close()method
public final function close():void

Closes the connection to the server.

connect()method 
public function connect():void

Attempts to connect to the ip and port specified.

doClose()method 
protected function doClose():void

Must be implemented in a new inherited class.

getExpectedInboundId()method 
public function getExpectedInboundId():Number

Gets the next expected inbound id.

Returns
Number — The next expected inbound id.
getId()method 
public function getId():Number

Gets the connection id.

Returns
Number — The connection id.
getIp()method 
public function getIp():String

Gets the ip used.

Returns
String — The ip used.
getIsConnected()method 
public function getIsConnected():Boolean

Returns true if connected, false if not.

Returns
Boolean — True or false.
getNextOutboundId()method 
public function getNextOutboundId():Number

Gets the next outbound id.

Returns
Number — The next outbound id.
getPort()method 
public function getPort():Number

Gets the port used.

Returns
Number — The port used.
getProtocol()method 
public function getProtocol():String

Gets the connection protocol.

Returns
String — The connection protocol.
onPreClose()method 
public function onPreClose():void

Used internally to tell whoever is listening that a connection close is happening.

onPreConnect()method 
public function onPreConnect(success:Boolean):void

Used internally to send an event to whoever is listening.

Parameters
success:Boolean — True or false.
send()method 
public function send(message:String):void

Sends a message to the server.

Parameters
message:String — message to send.
sendBinary()method 
public function sendBinary(ba:ByteArray):void

Sends a message to the server.

Parameters
ba:ByteArray — The message to send.
setExpectedInboundId()method 
public function setExpectedInboundId(id:Number):void

Sets the next expected inbound id.

Parameters
id:Number — The next inbound id to expect.
setId()method 
public function setId(id:Number):void

Sets the connection id.

Parameters
id:Number — The connection id.