Skip to content

Share tcp port between axum and tcp server #3146

Answered by mladedav
AeonSolstice asked this question in Q&A
Discussion options

You must be logged in to vote

If I understand the question correctly, you want to run an application on one port and handle the connection with axum if it's HTTP and somehow else if it is not? If so, I really think you don't want to do that, just use two different ports for the two different services. You might also want to look if a reverse proxy like nginx cannot do things like that if you need to use only one port because of firewall or something.

If you really need to do it, you might try implementing your own Listener which saves any data and use something like in the example of serve-with-hyper and if hyper errors out you can call the other service.

Or if your other protocol cannot contain arbitrary data from th…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AeonSolstice
Comment options

Answer selected by AeonSolstice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants