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 17:24:13 GMT
mturk       2005/04/16 10:24:13

  Modified:    jni/examples/org/apache/tomcat/jni Echo.java
  Log:
  Display local socket address too.
  
  Revision  Changes    Path
  1.7       +15 -6     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Echo.java	16 Apr 2005 16:45:13 -0000	1.6
  +++ Echo.java	16 Apr 2005 17:24:13 -0000	1.7
  @@ -101,12 +101,21 @@
                       
                       try {
                           long sa = Address.get(Socket.APR_REMOTE, clientSock);
  -                        Sockaddr addr = new Sockaddr();
  -                        if (Address.fill(addr, sa)) {
  -                            System.out.println("Host: " + Address.getnameinfo(sa, 0));
  -                            System.out.println("IP: " + Address.getip(sa) +
  -                                               ":" + addr.port);
  +                        Sockaddr raddr = new Sockaddr();
  +                        if (Address.fill(raddr, sa)) {
  +                            System.out.println("Remote Host: " + Address.getnameinfo(sa,
0));
  +                            System.out.println("Remote IP: " + Address.getip(sa) +
  +                                               ":" + raddr.port);
                           }
  +                        sa = Address.get(Socket.APR_LOCAL, clientSock);
  +                        Sockaddr laddr = new Sockaddr();
  +                        if (Address.fill(laddr, sa)) {
  +                            System.out.println("Local Host: " + laddr.hostname);
  +                            System.out.println("Local Server: " + Address.getnameinfo(sa,
0));
  +                            System.out.println("Local IP: " + Address.getip(sa) +
  +                                               ":" + laddr.port);
  +                        }                                        
  +                        
                       } catch (Exception e) {
                           // Ignore
                           e.printStackTrace();
  
  
  

---------------------------------------------------------------------
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