Update of /cvsroot/monetdb/java/src/nl/cwi/monetdb/mcl/net
In directory 
sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10653/src/nl/cwi/monetdb/mcl/net

Modified Files:
        MapiSocket.java 
Log Message:
Implemented getProtocolVersion().  I cannot update the version numbers
due to some confusement.  I will have to do this later once I can figure
out what is the fate of the Java module...


Index: MapiSocket.java
===================================================================
RCS file: /cvsroot/monetdb/java/src/nl/cwi/monetdb/mcl/net/MapiSocket.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- MapiSocket.java     4 Dec 2007 12:49:08 -0000       1.2
+++ MapiSocket.java     9 Dec 2007 16:20:29 -0000       1.3
@@ -77,7 +77,7 @@
  * @version 3.0
  */
 public final class MapiSocket {
-       /** The TCP Socket to Mserver */
+       /** The TCP Socket to mserver */
        private Socket con;
        /** Stream from the Socket for reading */
        private InputStream fromMonet;
@@ -87,6 +87,8 @@
        private BufferedMCLReader reader;
        /** MCLWriter on the OutputStream */
        private BufferedMCLWriter writer;
+       /** protocol version of the connection */
+       private int version;
 
        /** The database to connect to */
        private String database = null;
@@ -104,7 +106,7 @@
        private FileWriter log;
 
        /** The blocksize (hardcoded in compliance with stream.mx) */
-       public final static int BLOCK     = 8 * 1024 - 2;
+       public final static int BLOCK = 8 * 1024 - 2;
 
        /** A buffer which holds the blocks read */
        private StringBuffer readBuffer;
@@ -321,7 +323,6 @@
                        String database,
                        String hash
        ) throws MCLParseException, MCLException, IOException {
-               int version = 0;
                String response;
 
                // parse the challenge string, split it on ':'
@@ -342,6 +343,9 @@
                switch (version) {
                        default:
                                throw new MCLException("Unsupported protocol 
version: " + version);
+                       case 9:
+                               // proto 9 is like 8, but has extensions in the 
response
+                               // headers
                        case 8:
                                // proto 7 (finally) used the challenge and 
works with a
                                // password hash.  The supported 
implementations come
@@ -468,6 +472,17 @@
        }
 
        /**
+        * Returns the mapi protocol version used by this socket.  The
+        * protocol version depends on the server being used.  Users of the
+        * MapiSocket should check this version to act appropriately.
+        *
+        * @return the mapi protocol version
+        */
+       public int getProtocolVersion() {
+               return(version);
+       }
+
+       /**
         * Enables logging to a file what is read and written from and to
         * the server.  Logging can be enabled at any time.  However, it is
         * encouraged to start debugging before actually connecting the


-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to