本文整理了Java中org.apache.tomcat.jni.Address.getInfo()
方法的一些代码示例,展示了Address.getInfo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.getInfo()
方法的具体详情如下:
包路径:org.apache.tomcat.jni.Address
类名称:Address
方法名:getInfo
[英]Create the Sockaddr object from apr_sockaddr_t
[中]从apr\u Sockaddr\u t创建Sockaddr对象
代码示例来源:origin: apache/cloudstack
/**
* Connect this socket wrapper to remote server and start main loop on
* AprSocketSource stdout link, to watch for incoming data, and
* AprSocketSink stdin link, to pull for outgoing data.
*/
@Override
public void connect(InetSocketAddress address) throws IOException {
try {
inetAddress = Address.info(address.getHostName(), Socket.APR_UNSPEC, address.getPort(), 0, pool);
socket = Socket.create(Address.getInfo(inetAddress).family, Socket.SOCK_STREAM, Socket.APR_PROTO_TCP, pool);
} catch (Exception e) {
throw new IOException("[" + this + "] ERROR: Cannot create socket for \"" + address + "\".", e);
}
int ret = Socket.connect(socket, inetAddress);
if (ret != 0)
throw new IOException("[" + this + "] ERROR: Cannot connect to remote host \"" + address + "\": " + Error.strerror(ret));
source.setSocket(socket);
sink.setSocket(socket);
// Start polling for data to send to remote sever
runMainLoop(IN, STDIN, true, true);
// Push incoming data from server to handlers
runMainLoop(OUT, STDOUT, false, false);
}
代码示例来源:origin: codefollower/Tomcat-Research
public int getRemotePort() throws IOException {
if (socket != 0 && context.running) {
try {
long sa = Address.get(Socket.APR_REMOTE, socket);
Sockaddr addr = Address.getInfo(sa);
return addr.port;
} catch (Exception ex) {
throw new IOException(ex);
}
}
throw new IOException("Socket closed");
}
代码示例来源:origin: codefollower/Tomcat-Research
public int getLocalPort() throws IOException {
if (socket != 0 && context.running) {
try {
long sa = Address.get(Socket.APR_LOCAL, socket);
Sockaddr addr = Address.getInfo(sa);
return addr.port;
} catch (Exception ex) {
throw new IOException(ex);
}
}
throw new IOException("Socket closed");
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* 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;
}
}
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina
/**
* 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;
}
}
}
代码示例来源:origin: org.apache.coyote/com.springsource.org.apache.coyote
/**
* 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;
}
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
@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);
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
@Override
protected Long serverSocketAccept() throws Exception {
long socket = Socket.accept(serverSock);
if (log.isDebugEnabled()) {
long sa = Address.get(Socket.APR_REMOTE, socket);
Sockaddr addr = Address.getInfo(sa);
log.debug(sm.getString("endpoint.apr.remoteport",
Long.valueOf(socket),
Long.valueOf(addr.port)));
}
return Long.valueOf(socket);
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
@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);
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
@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);
}
}
代码示例来源:origin: org.apache.coyote.springsource/com.springsource.org.apache.coyote.springsource
port, 0, rootPool);
serverSock = Socket.create(Address.getInfo(inetAddress).family,
Socket.SOCK_STREAM,
Socket.APR_PROTO_TCP, rootPool);
代码示例来源:origin: org.jboss.web/jbossweb
serverSock = Socket.create(Address.getInfo(inetAddress).family, Socket.SOCK_STREAM,
Socket.APR_PROTO_TCP, rootPool);
if (OS.IS_UNIX) {
代码示例来源:origin: jboss.web/jbossweb
serverSock = Socket.create(Address.getInfo(inetAddress).family, Socket.SOCK_STREAM,
Socket.APR_PROTO_TCP, rootPool);
if (OS.IS_UNIX) {
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
getPort(), 0, rootPool);
serverSock = Socket.create(Address.getInfo(inetAddress).family,
Socket.SOCK_STREAM,
Socket.APR_PROTO_TCP, rootPool);
代码示例来源:origin: codefollower/Tomcat-Research
if (log.isDebugEnabled()) {
long sa = Address.get(Socket.APR_REMOTE, socket);
Sockaddr addr = Address.getInfo(sa);
log.debug(sm.getString("endpoint.apr.remoteport",
Long.valueOf(socket),
代码示例来源:origin: codefollower/Tomcat-Research
getPort(), 0, rootPool);
serverSock = Socket.create(Address.getInfo(inetAddress).family,
Socket.SOCK_STREAM,
Socket.APR_PROTO_TCP, rootPool);
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
getPort(), 0, rootPool);
serverSock = Socket.create(Address.getInfo(inetAddress).family,
Socket.SOCK_STREAM,
Socket.APR_PROTO_TCP, rootPool);
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina
try {
long sa = Address.get(Socket.APR_REMOTE, socketRef);
Sockaddr addr = Address.getInfo(sa);
remotePort = addr.port;
} catch (Exception e) {
try {
long sa = Address.get(Socket.APR_LOCAL, socketRef);
Sockaddr addr = Address.getInfo(sa);
localPort = addr.port;
} catch (Exception e) {
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
try {
long sa = Address.get(Socket.APR_REMOTE, socketRef);
Sockaddr addr = Address.getInfo(sa);
remotePort = addr.port;
} catch (Exception e) {
try {
long sa = Address.get(Socket.APR_LOCAL, socketRef);
Sockaddr addr = Address.getInfo(sa);
localPort = addr.port;
} catch (Exception e) {
代码示例来源:origin: codefollower/Tomcat-Research
try {
long sa = Address.get(Socket.APR_REMOTE, socketRef);
Sockaddr addr = Address.getInfo(sa);
socketWrapper.setRemotePort(addr.port);
} catch (Exception e) {
try {
long sa = Address.get(Socket.APR_LOCAL, socketRef);
Sockaddr addr = Address.getInfo(sa);
socketWrapper.setLocalPort(addr.port);
} catch (Exception e) {
内容来源于网络,如有侵权,请联系作者删除!