DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Package Functions | Private Attributes | List of all members
Deveel.Data.Client.TCPStreamDatabaseInterface Class Reference

Connection to the database via the TCP protocol. More...

Inheritance diagram for Deveel.Data.Client.TCPStreamDatabaseInterface:
Deveel.Data.Client.StreamDatabaseInterface

Package Functions

 TCPStreamDatabaseInterface (String host, int port, string initial_database)
 
void ConnectToDatabase ()
 Connects to the database. More...
 
- Package Functions inherited from Deveel.Data.Client.StreamDatabaseInterface
 StreamDatabaseInterface (string initial_database)
 
void Setup (Stream rawin, Stream rawout)
 Sets up the stream connection with the given input/output stream. More...
 

Private Attributes

readonly String host
 The name of the host we are connected to. More...
 
readonly int port
 The port we are connected to. More...
 
Socket socket
 The Socket connection. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Deveel.Data.Client.StreamDatabaseInterface
override void SendCommand (byte[] command, int offset, int size)
 
override byte[] ReceiveCommand (int timeout)
 
override void CloseConnection ()
 
- Protected Attributes inherited from Deveel.Data.Client.StreamDatabaseInterface
BinaryWriter output
 The data output stream for the db protocol. More...
 
BinaryReader input
 The data input stream for the db protocol. More...
 

Detailed Description

Connection to the database via the TCP protocol.

Definition at line 25 of file TCPStreamDatabaseInterface.cs.

Constructor & Destructor Documentation

Deveel.Data.Client.TCPStreamDatabaseInterface.TCPStreamDatabaseInterface ( String  host,
int  port,
string  initial_database 
)
inlinepackage

Definition at line 41 of file TCPStreamDatabaseInterface.cs.

42  : base(initial_database) {
43  this.host = host;
44  this.port = port;
45  }
readonly String host
The name of the host we are connected to.
readonly int port
The port we are connected to.

Member Function Documentation

void Deveel.Data.Client.TCPStreamDatabaseInterface.ConnectToDatabase ( )
inlinepackage

Connects to the database.

Definition at line 50 of file TCPStreamDatabaseInterface.cs.

50  {
51  if (socket != null) {
52  throw new DataException("Connection already established.");
53  }
54  try {
55  // Open a socket connection to the server.
56  socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
57  socket.Connect(host, port);
58  // Setup the stream with the given input and output streams.
59  Setup(new NetworkStream(socket, FileAccess.Read), new NetworkStream(socket, FileAccess.Write));
60  } catch (IOException e) {
61  throw new DataException(e.Message);
62  }
63  }
void Setup(Stream rawin, Stream rawout)
Sets up the stream connection with the given input/output stream.
readonly String host
The name of the host we are connected to.
readonly int port
The port we are connected to.

Member Data Documentation

readonly String Deveel.Data.Client.TCPStreamDatabaseInterface.host
private

The name of the host we are connected to.

Definition at line 29 of file TCPStreamDatabaseInterface.cs.

readonly int Deveel.Data.Client.TCPStreamDatabaseInterface.port
private

The port we are connected to.

Definition at line 34 of file TCPStreamDatabaseInterface.cs.

Socket Deveel.Data.Client.TCPStreamDatabaseInterface.socket
private

The Socket connection.

Definition at line 39 of file TCPStreamDatabaseInterface.cs.


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