是否有可能使用 QuickFix 引擎获取源 IP?我的服务器是接受者,我需要源 IP 来记录日志。谢谢
问问题
441 次
1 回答
0
如果您查看日志,您可以看到客户端连接到接受器时提到的 IP 地址。例如,我在我的机器上同时运行了接受器和客户端并看到了这个:
Jul 21, 2013 6:19:26 PM quickfix.mina.acceptor.AcceptorIoHandler sessionCreated
INFO: MINA session created: /127.0.0.1:50731
Jul 21, 2013 6:19:26 PM quickfix.mina.acceptor.AcceptorIoHandler sessionCreated
INFO: MINA session created: /127.0.0.1:50732
Jul 21, 2013 6:19:26 PM quickfix.mina.acceptor.AcceptorIoHandler sessionCreated
INFO: MINA session created: /127.0.0.1:50733
Jul 21, 2013 6:19:26 PM quickfix.mina.acceptor.AcceptorIoHandler sessionCreated
INFO: MINA session created: /127.0.0.1:50734
Jul 21, 2013 6:19:26 PM quickfix.mina.acceptor.AcceptorIoHandler sessionCreated
INFO: MINA session created: /127.0.0.1:50735
Jul 21, 2013 6:19:26 PM quickfix.mina.acceptor.AcceptorIoHandler sessionCreated
INFO: MINA session created: /127.0.0.1:50736
<20130721-09:19:27, FIX.4.3:EXEC->BANZAI, incoming> (8=FIX.4.39=6635=A34=2049=BANZAI52=20130721-09:19:27.64356=EXEC98=0108=3010=021)
<20130721-09:19:27, FIX.4.3:EXEC->BANZAI, event> (Accepting session FIX.4.3:EXEC->BANZAI from /127.0.0.1:50731)
<20130721-09:19:27, FIX.4.3:EXEC->BANZAI, event> (Acceptor heartbeat set to 30 seconds)
<20130721-09:19:27, FIX.4.3:EXEC->BANZAI, event> (Received logon)
<20130721-09:19:27, FIX.4.3:EXEC->BANZAI, event> (Responding to Logon request)
<20130721-09:19:27, FIX.4.3:EXEC->BANZAI, outgoing> (8=FIX.4.39=6635=A34=2249=EXEC52=20130721-09:19:27.65256=BANZAI98=0108=3010=023)
<20130721-09:19:27, FIX.4.2:EXEC->BANZAI, incoming> (8=FIX.4.29=6635=A34=1749=BANZAI52=20130721-09:19:27.65256=EXEC98=0108=3010=026)
<20130721-09:19:27, FIX.4.2:EXEC->BANZAI, event> (Accepting session FIX.4.2:EXEC->BANZAI from /127.0.0.1:50736)
<20130721-09:19:27, FIX.4.2:EXEC->BANZAI, event> (Acceptor heartbeat set to 30 seconds)
<20130721-09:19:27, FIX.4.2:EXEC->BANZAI, event> (Received logon)
<20130721-09:19:27, FIX.4.2:EXEC->BANZAI, event> (Responding to Logon request)
<20130721-09:19:27, FIX.4.2:EXEC->BANZAI, outgoing> (8=FIX.4.29=6635=A34=1749=EXEC52=20130721-09:19:27.65356=BANZAI98=0108=3010=027)
<20130721-09:19:27, FIX.4.1:EXEC->BANZAI, incoming> (8=FIX.4.19=6235=A34=1749=BANZAI52=20130721-09:19:2756=EXEC98=0108=3010=074)
<20130721-09:19:27, FIX.4.1:EXEC->BANZAI, event> (Accepting session FIX.4.1:EXEC->BANZAI from /127.0.0.1:50734)
<20130721-09:19:27, FIX.4.1:EXEC->BANZAI, event> (Acceptor heartbeat set to 30 seconds)
<20130721-09:19:27, FIX.4.1:EXEC->BANZAI, event> (Received logon)
<20130721-09:19:27, FIX.4.1:EXEC->BANZAI, event> (Responding to Logon request)
<20130721-09:19:27, FIX.4.1:EXEC->BANZAI, outgoing> (8=FIX.4.19=6235=A34=1849=EXEC52=20130721-09:19:2756=BANZAI98=0108=3010=075)
<20130721-09:19:27, FIX.4.4:EXEC->BANZAI, incoming> (8=FIX.4.49=6635=A34=1749=BANZAI52=20130721-09:19:27.65956=EXEC98=0108=3010=035)
<20130721-09:19:27, FIX.4.4:EXEC->BANZAI, event> (Accepting session FIX.4.4:EXEC->BANZAI from /127.0.0.1:50732)
<20130721-09:19:27, FIX.4.4:EXEC->BANZAI, event> (Acceptor heartbeat set to 30 seconds)
<20130721-09:19:27, FIX.4.4:EXEC->BANZAI, event> (Received logon)
<20130721-09:19:27, FIX.4.4:EXEC->BANZAI, event> (Responding to Logon request)
<20130721-09:19:27, FIX.4.4:EXEC->BANZAI, outgoing> (8=FIX.4.49=6635=A34=1949=EXEC52=20130721-09:19:27.66156=BANZAI98=0108=3010=030)
<20130721-09:19:27, FIX.4.0:EXEC->BANZAI, incoming> (8=FIX.4.09=6235=A34=1749=BANZAI52=20130721-09:19:2756=EXEC98=0108=3010=073)
<20130721-09:19:27, FIX.4.0:EXEC->BANZAI, event> (Accepting session FIX.4.0:EXEC->BANZAI from /127.0.0.1:50733)
<20130721-09:19:27, FIX.4.0:EXEC->BANZAI, event> (Acceptor heartbeat set to 30 seconds)
<20130721-09:19:27, FIX.4.0:EXEC->BANZAI, event> (Received logon)
<20130721-09:19:27, FIX.4.0:EXEC->BANZAI, event> (Responding to Logon request)
<20130721-09:19:27, FIX.4.0:EXEC->BANZAI, outgoing> (8=FIX.4.09=6235=A34=1849=EXEC52=20130721-09:19:2756=BANZAI98=0108=3010=074)
<20130721-09:19:27, FIXT.1.1:EXEC->BANZAI, incoming> (8=FIXT.1.19=7335=A34=1749=BANZAI52=20130721-09:19:27.66856=EXEC98=0108=301137=710=176)
<20130721-09:19:27, FIXT.1.1:EXEC->BANZAI, event> (Accepting session FIXT.1.1:EXEC->BANZAI from /127.0.0.1:50735)
<20130721-09:19:27, FIXT.1.1:EXEC->BANZAI, event> (Acceptor heartbeat set to 30 seconds)
Jul 21, 2013 6:19:27 PM quickfix.mina.acceptor.AcceptorIoHandler processMessage
INFO: Setting DefaultApplVerID (1137=7) from Logon
<20130721-09:19:27, FIXT.1.1:EXEC->BANZAI, event> (Received logon)
<20130721-09:19:27, FIXT.1.1:EXEC->BANZAI, event> (Responding to Logon request)
<20130721-09:19:27, FIXT.1.1:EXEC->BANZAI, outgoing> (8=FIXT.1.19=7335=A34=1849=EXEC52=20130721-09:19:27.67056=BANZAI98=0108=301137=710=170)
我希望这会有所帮助。代码源随 QuickfixJ 下载一起提供。
于 2013-07-21T09:49:52.930 回答