gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] storm/org/nongnu/storm/http/server HTTPConnecti...


From: Hermanni Hyytiälä
Subject: [Gzz-commits] storm/org/nongnu/storm/http/server HTTPConnecti...
Date: Mon, 05 May 2003 09:57:09 -0400

CVSROOT:        /cvsroot/storm
Module name:    storm
Changes by:     Hermanni Hyytiälä <address@hidden>      03/05/05 09:57:09

Modified files:
        org/nongnu/storm/http/server: HTTPConnection.java 

Log message:
        Get remote host's ip-address

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/http/server/HTTPConnection.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: storm/org/nongnu/storm/http/server/HTTPConnection.java
diff -u storm/org/nongnu/storm/http/server/HTTPConnection.java:1.2 
storm/org/nongnu/storm/http/server/HTTPConnection.java:1.3
--- storm/org/nongnu/storm/http/server/HTTPConnection.java:1.2  Mon Apr 21 
17:07:41 2003
+++ storm/org/nongnu/storm/http/server/HTTPConnection.java      Mon May  5 
09:57:09 2003
@@ -44,8 +44,8 @@
     static public boolean dbg = false;
     static private void p(String s) { if(dbg) System.out.println(s); }
     static private void pa(String s) { System.out.println(s); }
-
-
+    static private String remoteaddress;
+    
     /** A factory of application-specific HTTP connection objects.
      * @see HTTPConnection
      */
@@ -55,7 +55,7 @@
          * @throws IOException XXX
         */
         public HTTPConnection newConnection(Socket s) throws IOException {
-            p("httpconn");
+            p("httpconn");                 
             return new HTTPConnection(s);
         }
     }
@@ -65,19 +65,21 @@
      * @throws IOException Indicates a problem with the socket
      */
     protected HTTPConnection(Socket s) throws IOException {
-        this(s.getInputStream(), s.getOutputStream());
+        this(s.getInputStream(), s.getOutputStream(), 
+       s.getInetAddress().toString().substring(1));    
     }
 
     /** Create a new connection object.
      * @param is The input stream for this connection
      * @param os The output stream for this connection
      */
-    protected HTTPConnection(InputStream is, OutputStream os) {
+    protected HTTPConnection(InputStream is, OutputStream os, String 
ipaddress) {
         this.is = is;
         this.os = os;
+       this.remoteaddress = ipaddress;
         thread.start();
     }
-
+        
     /** Close this connection forcefully.  This ends the thread
      * handling this connection and sends a notice to the client if
      * necessary.  */
@@ -92,6 +94,15 @@
             }
         }
     }
+    
+     /** Return the IP-address of remote host */
+    
+    public String getRemoteIPAddress() {
+       
+       return this.remoteaddress;
+       
+    }    
+   
 
     /** An end-of-connection hook.  A subclass can override this
      * method and thus be informed when the connection is closed for
@@ -355,7 +366,8 @@
            // XXX not only when dbg is on?
             if(dbg) e.printStackTrace();
         }
-    }
+    }    
+    
 
 
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]