tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni Echo.java
Date Sat, 16 Apr 2005 15:47:42 GMT
mturk       2005/04/16 08:47:42

  Modified:    jni/examples/org/apache/tomcat/jni Echo.java
  Log:
  Display remote connection socket info.
  
  Revision  Changes    Path
  1.5       +15 -2     jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java
  
  Index: Echo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Echo.java	16 Apr 2005 10:46:55 -0000	1.4
  +++ Echo.java	16 Apr 2005 15:47:42 -0000	1.5
  @@ -90,6 +90,19 @@
                   while (true) {
                       long clientSock = Socket.accept(serverSock, pool);
                       System.out.println("Accepted id: " +  i);
  +                    try {
  +                        long sa = Address.get(Socket.APR_REMOTE, clientSock);
  +                        Sockaddr addr = new Sockaddr();
  +                        if (Address.fill(addr, sa)) {
  +                            System.out.println("Host: " + Address.getnameinfo(clientSock,
0));
  +                            System.out.println("IP: " + Address.getip(sa) +
  +                                               ":" + addr.port);
  +                        }
  +                    } catch (Exception e) {
  +                        // Ignore
  +                        e.printStackTrace();
  +                    }
  +
                       Socket.timeoutSet(clientSock, 10000000);
                       Worker worker = new Worker(clientSock, i++,
                                                  this.getClass().getName());
  @@ -153,7 +166,7 @@
                           long clientSock = Poll.socket(desc[n]);
                           int  workerId   = (int)Poll.data(desc[n]);
                           System.out.println("Poll flags " + Poll.events(desc[n]));
  -                        remove(clientSock, workerId);                        
  +                        remove(clientSock, workerId);
                           Worker worker = new Worker(clientSock, workerId,
                                                      this.getClass().getName());
                           Echo.incThreads();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message