Java Code Examples for org.apache.tomcat.jni.Address#get()
The following examples show how to use
org.apache.tomcat.jni.Address#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AprEndpoint.java From Tomcat8-Source-Read with MIT License | 6 votes |
@Override protected void populateRemoteHost() { if (closed) { return; } try { long socket = getSocket().longValue(); long sa = Address.get(Socket.APR_REMOTE, socket); remoteHost = Address.getnameinfo(sa, 0); if (remoteAddr == null) { remoteAddr = Address.getip(sa); } } catch (Exception e) { log.warn(sm.getString("endpoint.warn.noRemoteHost", getSocket()), e); } }
Example 2
Source File: AprEndpoint.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * Port in use. */ @Override public int getLocalPort() { long s = serverSock; if (s == 0) { return -1; } else { long sa; try { sa = Address.get(Socket.APR_LOCAL, s); Sockaddr addr = Address.getInfo(sa); return addr.port; } catch (Exception e) { return -1; } } }
Example 3
Source File: AprEndpoint.java From tomcatsrc with Apache License 2.0 | 6 votes |
/** * Port in use. */ @Override public int getLocalPort() { long s = serverSock; if (s == 0) { return -1; } else { long sa; try { sa = Address.get(Socket.APR_LOCAL, s); Sockaddr addr = Address.getInfo(sa); return addr.port; } catch (Exception e) { return -1; } } }
Example 4
Source File: AprEndpoint.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override public InetSocketAddress getLocalAddress() throws IOException { long s = serverSock; if (s == 0) { return null; } else { long sa; try { sa = Address.get(Socket.APR_LOCAL, s); } catch (IOException ioe) { // re-throw throw ioe; } catch (Exception e) { // wrap throw new IOException(e); } Sockaddr addr = Address.getInfo(sa); if (addr.hostname == null) { // any local address if (addr.family == Socket.APR_INET6) { return new InetSocketAddress("::", addr.port); } else { return new InetSocketAddress("0.0.0.0", addr.port); } } return new InetSocketAddress(addr.hostname, addr.port); } }
Example 5
Source File: AprEndpoint.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override protected void populateRemoteAddr() { if (closed) { return; } try { long socket = getSocket().longValue(); long sa = Address.get(Socket.APR_REMOTE, socket); remoteAddr = Address.getip(sa); } catch (Exception e) { log.warn(sm.getString("endpoint.warn.noRemoteAddr", getSocket()), e); } }
Example 6
Source File: AprEndpoint.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override protected void populateRemotePort() { if (closed) { return; } try { long socket = getSocket().longValue(); long sa = Address.get(Socket.APR_REMOTE, socket); Sockaddr addr = Address.getInfo(sa); remotePort = addr.port; } catch (Exception e) { log.warn(sm.getString("endpoint.warn.noRemotePort", getSocket()), e); } }
Example 7
Source File: AprEndpoint.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override protected void populateLocalName() { if (closed) { return; } try { long socket = getSocket().longValue(); long sa = Address.get(Socket.APR_LOCAL, socket); localName =Address.getnameinfo(sa, 0); } catch (Exception e) { log.warn(sm.getString("endpoint.warn.noLocalName"), e); } }
Example 8
Source File: AprEndpoint.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override protected void populateLocalAddr() { if (closed) { return; } try { long socket = getSocket().longValue(); long sa = Address.get(Socket.APR_LOCAL, socket); localAddr = Address.getip(sa); } catch (Exception e) { log.warn(sm.getString("endpoint.warn.noLocalAddr"), e); } }
Example 9
Source File: AprEndpoint.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override protected void populateLocalPort() { if (closed) { return; } try { long socket = getSocket().longValue(); long sa = Address.get(Socket.APR_LOCAL, socket); Sockaddr addr = Address.getInfo(sa); localPort = addr.port; } catch (Exception e) { log.warn(sm.getString("endpoint.warn.noLocalPort"), e); } }