[QFJ-777] Determine session's IP address Created: 15/Apr/14  Updated: 02/Apr/15  Resolved: 17/Apr/14

Status: Closed
Project: QuickFIX/J
Component/s: Networking
Affects Version/s: None
Fix Version/s: 1.6.0

Type: Improvement Priority: Default
Reporter: Daniil S Assignee: Christoph John
Resolution: Fixed Votes: 0
Labels: None


 Description   

Really need a way of determining IP address for the session. This is especially useful for incoming sessions.



 Comments   
Comment by Christoph John [ 15/Apr/14 ]

Hi, could you please elaborate further on what you need? Do I understand correctly that you want to see the IP address of the counterparty? Is this QFJ-758?

Comment by Daniil S [ 15/Apr/14 ]

Its in similar area. We have a need to authenticate/restrict incoming sessions by source IP address. Either whole address or a regex. And its useful to have this for live debugging. I've modified (probably really badly) QFJ 1.3.3 to have method session.getRemoteIP() and will have to do similar with 1.6

Comment by Christoph John [ 15/Apr/14 ]

Hmm, but we have configuration AllowedRemoteAddresses since some versions already. Doesn't this work for you?

Comment by Daniil S [ 15/Apr/14 ]

Yes, but it won't take in regex.

Comment by Christoph John [ 16/Apr/14 ]

You could do a Session.getResponder().getRemoteIPAddress() which will return the address of the remote peer. Is this what you want.
We could also add a convenience method to the Session which returns that remote address.

Comment by Daniil S [ 17/Apr/14 ]

This does the job perfectly! I feel the need to point out how thorough this project is and that I simply don't spend enough time digging through it.

Comment by Christoph John [ 17/Apr/14 ]

Great, thanks for the feedback.
I've now added a convenience method anyway, since the indirection via Session.getResponder().getRemoteIPAddress() seemed a bit unnatural to me.

http://sourceforge.net/p/quickfixj/code/1181/

Comment by Daniil S [ 17/Apr/14 ]

Thanks, this would definitely be a great improvement. One note though, since you're using toString() method it will be a full address (/192.0.0.1:1111) not just an IP (192.0.0.1). This should be noted in a comment to avoid potential comparison problems (people may assume actual IP and not full address).

Comment by Christoph John [ 17/Apr/14 ]

Thanks for the info. Of course, you're right. I've changed the method name and comment to reflect this.

Generated at Sat Nov 23 07:34:21 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.