DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Public Attributes | Protected Member Functions | Properties | Private Member Functions | List of all members
Deveel.Data.Protocol.TcpClientConnector Class Reference
Inheritance diagram for Deveel.Data.Protocol.TcpClientConnector:
Deveel.Data.Protocol.NetworkClientConnector Deveel.Data.Protocol.IClientConnector Deveel.Data.Protocol.IConnector

Public Member Functions

override ConnectionEndPoint MakeEndPoint (IDictionary< string, object > properties)
 
- Public Member Functions inherited from Deveel.Data.Protocol.NetworkClientConnector
void Dispose ()
 
virtual IMessageProcessor CreateProcessor ()
 
virtual IMessageEnvelope CreateEnvelope (IDictionary< string, object > metadata, IMessage message)
 
IStreamableObjectChannel CreateObjectChannel (long objectId)
 
ITriggerChannel CreateTriggerChannel (string triggerName, string objectName, TriggerEventType eventType)
 
void SetEncrypton (EncryptionData encryptionData)
 
- Public Member Functions inherited from Deveel.Data.Protocol.IConnector
ITriggerChannel CreateTriggerChannel (string triggerName, string objectName, TriggerEventType eventType)
 

Public Attributes

const int DefaultPort = 6669
 

Protected Member Functions

override NetworkStream CreateNetworkStream (ConnectionEndPoint remoteEndPoint, FileAccess access)
 
- Protected Member Functions inherited from Deveel.Data.Protocol.NetworkClientConnector
 NetworkClientConnector ()
 
virtual void Dispose (bool disposing)
 
void ChangeState (ConnectorState newState)
 
void OpenConnector (ConnectionEndPoint remoteEndPoint)
 
void Close ()
 
virtual void OnAuthenticated (string username, long timeStamp)
 
virtual void OnConnectorOpen ()
 
virtual IMessage OnProcessServerResponse (IMessageEnvelope envelope)
 
virtual byte[] SerializeEnvelope (IMessageEnvelope envelope)
 
void SendEnvelope (IMessageEnvelope envelope)
 
virtual IMessageEnvelope DeserializeEnvelope (byte[] bytes)
 
virtual bool ShouldReceive (IDictionary< string, object > senderMetadata, IMessageEnvelope envelope)
 
virtual void OnTriggerNotification (IMessageEnvelope envelope)
 

Properties

override ConnectionEndPoint LocalEndPoint [get]
 
- Properties inherited from Deveel.Data.Protocol.NetworkClientConnector
int Timeout [get, set]
 
Stream InputStream [get, set]
 
Stream OutputStream [get, set]
 
ConnectorState CurrentState [get, private set]
 
abstract ConnectionEndPoint LocalEndPoint [get]
 
ConnectionEndPoint RemoteEndPoint [get, private set]
 
- Properties inherited from Deveel.Data.Protocol.IConnector
ConnectorState CurrentState [get]
 
ConnectionEndPoint LocalEndPoint [get]
 

Private Member Functions

EndPoint ParseEndPoint (string s)
 

Detailed Description

Definition at line 24 of file TcpClientConnector.cs.

Member Function Documentation

override NetworkStream Deveel.Data.Protocol.TcpClientConnector.CreateNetworkStream ( ConnectionEndPoint  remoteEndPoint,
FileAccess  access 
)
inlineprotectedvirtual

Implements Deveel.Data.Protocol.NetworkClientConnector.

Definition at line 65 of file TcpClientConnector.cs.

65  {
66  if (remoteEndPoint == null)
67  throw new ArgumentNullException("remoteEndPoint");
68  if (remoteEndPoint.Protocol != KnownConnectionProtocols.TcpIp)
69  throw new ArgumentException();
70 
71  var endPoint = ParseEndPoint(remoteEndPoint.Address);
72 
73  var sockect = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
74  sockect.SendTimeout = Timeout;
75  sockect.ReceiveTimeout = Timeout;
76  sockect.Connect(endPoint);
77 
78  return new NetworkStream(sockect, access, true);
79  }
override ConnectionEndPoint Deveel.Data.Protocol.TcpClientConnector.MakeEndPoint ( IDictionary< string, object >  properties)
inlinevirtual

Implements Deveel.Data.Protocol.NetworkClientConnector.

Definition at line 31 of file TcpClientConnector.cs.

31  {
32  object hostObj, portObj;
33  if (!properties.TryGetValue("Host", out hostObj))
34  throw new InvalidOperationException("Could not find the host address.");
35 
36  var host = (string) hostObj;
37  var port = DefaultPort;
38 
39  if (properties.TryGetValue("Port", out portObj))
40  port = (int) portObj;
41 
42  var address = new StringBuilder(host);
43  if (port > 0 && port != DefaultPort)
44  address.AppendFormat(":{0}", port);
45 
46  return new ConnectionEndPoint(KnownConnectionProtocols.TcpIp, address.ToString());
47  }
EndPoint Deveel.Data.Protocol.TcpClientConnector.ParseEndPoint ( string  s)
inlineprivate

Definition at line 49 of file TcpClientConnector.cs.

49  {
50  string address = s;
51  int port = DefaultPort;
52 
53  var sepIndex = address.IndexOf(':');
54  if (sepIndex != -1) {
55  string sPort = address.Substring(sepIndex + 1);
56  if (!Int32.TryParse(sPort, out port))
57  throw new FormatException();
58 
59  address = address.Substring(0, sepIndex);
60  }
61 
62  return new IPEndPoint(IPAddress.Parse(address), port);
63  }

Member Data Documentation

const int Deveel.Data.Protocol.TcpClientConnector.DefaultPort = 6669

Definition at line 25 of file TcpClientConnector.cs.

Property Documentation

override ConnectionEndPoint Deveel.Data.Protocol.TcpClientConnector.LocalEndPoint
get

Definition at line 27 of file TcpClientConnector.cs.


The documentation for this class was generated from the following file: