static void Main(string[] args) { Console.WriteLine("Remote host: "); string host = Console.ReadLine(); CConnectionContext cc = new CConnectionContext(host, 20901, "usqlite_client", "password_for_usqlite"); using (CSocketPool <CSqlite> spSqlite = new CSocketPool <CSqlite>()) { //spSqlite.QueueName = "qsqlite"; if (!spSqlite.StartSocketPool(cc, 1)) { Console.WriteLine("Failed in connecting to remote async sqlite server"); Console.WriteLine("Press any key to close the application ......"); Console.Read(); return; } CSqlite sqlite = spSqlite.Seek(); //a container for receiving all tables data List <KeyValue> lstRowset = new List <KeyValue>(); try { //stream all DB requests with in-line batching for the best network efficiency //open a global database at server side because an empty string is given var topen = sqlite.open(""); //prepare two test tables, COMPANY and EMPLOYEE Task <CAsyncDBHandler.SQLExeInfo>[] vT = TestCreateTables(sqlite); var tbt = sqlite.beginTrans(); //start manual transaction //test both prepare and query statements var tp0 = TestPreparedStatements(sqlite, lstRowset); //test both prepare and query statements involved with reading and updating BLOB and large text var tp1 = TestBLOBByPreparedStatement(sqlite, lstRowset); var tet = sqlite.endTrans(); //end manual transaction var vB = TestBatch(sqlite, lstRowset); Console.WriteLine("All SQL requests streamed, and waiting for their results"); Console.WriteLine(topen.Result); foreach (var e in vT) { Console.WriteLine(e.Result); } Console.WriteLine(tbt.Result); Console.WriteLine(tp0.Result); Console.WriteLine(tp1.Result); Console.WriteLine(tet.Result); foreach (var e in vB) { Console.WriteLine(e.Result); } } catch (AggregateException ex) { foreach (Exception e in ex.InnerExceptions) { //An exception from server (CServerError), Socket closed after sending a request (CSocketError) or request canceled (CSocketError), Console.WriteLine(e); } } catch (CSocketError ex) { //Socket is already closed before sending a request Console.WriteLine(ex); } catch (Exception ex) { //bad operations such as invalid arguments, bad operations and de-serialization errors, and so on Console.WriteLine(ex); } //display received rowsets int index = 0; Console.WriteLine(); Console.WriteLine("+++++ Start rowsets +++"); foreach (KeyValue it in lstRowset) { Console.Write("Statement index = {0}", index); if (it.Key.Count > 0) { Console.WriteLine(", rowset with columns = {0}, records = {1}.", it.Key.Count, it.Value.Count / it.Key.Count); } else { Console.WriteLine(", no rowset received."); } ++index; } Console.WriteLine("+++++ End rowsets +++"); Console.WriteLine(); Console.WriteLine("Press any key to close the application ......"); Console.Read(); } }