Packagecom.electrotank.electroserver4.connection
Classpublic class Connection
InheritanceConnection Inheritance AbstractConnection Inheritance Observable

This class is used internally to the ElectroServer class. When you want to create a new connection use ElectroServer.createConnection. This class is used to handle text-based socket connections to the server.



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

Creates a new instance of the Connection class.

Parameters
tmpip:String — The ip to connect to.
 
tmpport:Number — The port to use.
 
protocol:String
Method detail
connect()method
public override function connect():void

Attempts to connect to the ip and port specified.

doClose()method 
protected override function doClose():void

Closes the connection to the server.

onPreData()method 
public function onPreData(data:String):void

Used internally to tell whoever is listening that data has just arrived.

Parameters
data:String — The data.
send()method 
public override function send(message:String):voidParameters
message:String
sendBinary()method 
public override function sendBinary(ba:ByteArray):voidParameters
ba:ByteArray