[英]How to know who is the requester in Jpos?
I have a program using jpos, i want to filter so my server only respond from specific ip or port. 我有一个使用jpos的程序,我想过滤,因此我的服务器仅从特定的ip或端口响应。
how to know where message come from ? 如何知道消息从何而来? This is my simple code 这是我的简单代码
public class ServerListener implements ISORequestListener {
private final static Logger logger = LoggerFactory.getLogger(ServerListener.class);
@Override
public boolean process(ISOSource requester, ISOMsg reqMsg) {
logger.debug("Heder Destinatnion " +reqMsg.getISOHeader().getDestination());
logger.debug("Heder Source " +reqMsg.getISOHeader().getSource());
return false
}
}
the log only show 日志只显示
Heder Destinatnion = null Heder Destinatnion =空
Heder Source = null Heder Source =空
If your ISOSource
implementation is actually a channel that extends BaseChannel
(most channel implementations extend BaseChannel
), then you can cast your ISOSource
to BaseChannel
and get a reference to the underlying socket using BaseChannel.getSocket()
. 如果您的ISOSource
实现实际上是扩展BaseChannel
的通道(大多数通道实现扩展了BaseChannel
),则可以将ISOSource
为BaseChannel
并使用BaseChannel.getSocket()
获取对基础套接字的引用。
If you are using QServer
you can configure the allowed hosts using the allow
property. 如果使用的是QServer
,则可以使用allow
属性配置允许的主机。
And of course, you can use a firewall. 当然,您可以使用防火墙。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.