Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind SocketInitiator to specific host/port #744

Open
cyphersys opened this issue Oct 2, 2022 · 4 comments
Open

Bind SocketInitiator to specific host/port #744

cyphersys opened this issue Oct 2, 2022 · 4 comments

Comments

@cyphersys
Copy link

Hello!

I found that QuickFix/J has settings on Initiator section as SocketLocalHost and SocketLocalPort to bind the socket initiator to a single IP and/or Port. Is possible implement them?

Thank you in advance

Regards

@NikolayStek
Copy link

In QuickFix/n you also can set direct ip and port in *.cfg or replace in init Session setting code this params:
SocketConnectHost - your direct IP
SocketConnectPort - port
SSLServerName - DNS name for SSL connection

@cyphersys
Copy link
Author

Hello,

Thanks for your reply. I was specifically referring to binding SocketInitiator to a single IP (interface) in case the computer where QF/n Initiator is running has multiple IPs assigned to it.

Currently QuickFix/n selects the first IP address of the NIC.

Thanks!

@NikolayStek
Copy link

Sorry, I misunderstood you at first. Your idea is cool, especially if there are restrictions on rate limits for IP. Now they don’t have such support out of the box, but you can add

socket.Bind(new IPEndPoint(settings.LocalIp, settings.LocalPort)); 

after

socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

also you need to add you custom local interface fields(LocalIp, LocalPort) to SocketSettings. Currently i can't check it, but hope this works.

@cyphersys
Copy link
Author

cyphersys commented Mar 2, 2023

Sorry, I misunderstood you at first. Your idea is cool, especially if there are restrictions on rate limits for IP. Now they don’t have such support out of the box, but you can add

socket.Bind(new IPEndPoint(settings.LocalIp, settings.LocalPort)); 

after

socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

also you need to add you custom local interface fields(LocalIp, LocalPort) to SocketSettings. Currently i can't check it, but hope this works.

Hello, sorry for my delayed reply.

I have done something very similar to your suggestion, previously before writing this issue.
I only wanted to request it as a native feature of QF/n.

Thank you

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants