Forwarding Traffic From One Port to Another and Vice Versa
The goal: Have process A send messages to process B and vice versa via TCP (I'm using ROSBridge).
The problem: Only one process can use a port at a time
The solution (?): Have process A use port 9090 but forward the traffic to 9091 and have process B use port 9091 but forward the traffic to port 9090.
The question: Will this solution work or would I get an infinite loop of repeating data? Any way not to do that? If this would work, how do I set it up? If it will not work, what else can I do?
networking iptables port-forwarding tcp-ip
New contributor
add a comment |
The goal: Have process A send messages to process B and vice versa via TCP (I'm using ROSBridge).
The problem: Only one process can use a port at a time
The solution (?): Have process A use port 9090 but forward the traffic to 9091 and have process B use port 9091 but forward the traffic to port 9090.
The question: Will this solution work or would I get an infinite loop of repeating data? Any way not to do that? If this would work, how do I set it up? If it will not work, what else can I do?
networking iptables port-forwarding tcp-ip
New contributor
Not sure what you mean by "forward" in this case, since traffic originating at 9090 is sent (not forwarded) to 9091. If you have traffic from process X on port 8500 that must be sent to both A and B, send one message to each independently, no forwarding. TCP is a unicast (not multicast) protocol.
– user535733
Jan 16 at 16:04
Generally, interprocess communication in Ubuntu is handled by dbus, which is already installed, and has lots useful features, and lots of bindings available. Look it up. Feel free to use it, that's what it is there for, You can implement your own, of course, using pipes, named pipes, sockets, shared files, and other methods, if you wish - use of dbus is merely convenient, not required.
– user535733
Jan 16 at 16:06
It's possible (and perhaps likely) that I just don't understand ports. When I launch my ROSBridge node, I tell it to use port 9090 for sending/receiving data. My other process, Unity, needs to send and receive data from ROSBridge so I need to also tell it to use port 9090 where the data is. If I tell it to use a different port, it will not see the ROSBridge Data. Unfortunately, it seems that two processes can't use the same port. That, or I'm getting some other problem that I'm not aware of. It works fine, however, if my Unity app is on a different PC. I know nothing of unicast or multicast.
– CodeMonkey
Jan 16 at 16:40
As for dbus, I'm utilizing pre-made packages where you simply select the port to use. It seems I may have to modify them though to get what I need...
– CodeMonkey
Jan 16 at 16:42
add a comment |
The goal: Have process A send messages to process B and vice versa via TCP (I'm using ROSBridge).
The problem: Only one process can use a port at a time
The solution (?): Have process A use port 9090 but forward the traffic to 9091 and have process B use port 9091 but forward the traffic to port 9090.
The question: Will this solution work or would I get an infinite loop of repeating data? Any way not to do that? If this would work, how do I set it up? If it will not work, what else can I do?
networking iptables port-forwarding tcp-ip
New contributor
The goal: Have process A send messages to process B and vice versa via TCP (I'm using ROSBridge).
The problem: Only one process can use a port at a time
The solution (?): Have process A use port 9090 but forward the traffic to 9091 and have process B use port 9091 but forward the traffic to port 9090.
The question: Will this solution work or would I get an infinite loop of repeating data? Any way not to do that? If this would work, how do I set it up? If it will not work, what else can I do?
networking iptables port-forwarding tcp-ip
networking iptables port-forwarding tcp-ip
New contributor
New contributor
New contributor
asked Jan 16 at 14:14
CodeMonkeyCodeMonkey
1013
1013
New contributor
New contributor
Not sure what you mean by "forward" in this case, since traffic originating at 9090 is sent (not forwarded) to 9091. If you have traffic from process X on port 8500 that must be sent to both A and B, send one message to each independently, no forwarding. TCP is a unicast (not multicast) protocol.
– user535733
Jan 16 at 16:04
Generally, interprocess communication in Ubuntu is handled by dbus, which is already installed, and has lots useful features, and lots of bindings available. Look it up. Feel free to use it, that's what it is there for, You can implement your own, of course, using pipes, named pipes, sockets, shared files, and other methods, if you wish - use of dbus is merely convenient, not required.
– user535733
Jan 16 at 16:06
It's possible (and perhaps likely) that I just don't understand ports. When I launch my ROSBridge node, I tell it to use port 9090 for sending/receiving data. My other process, Unity, needs to send and receive data from ROSBridge so I need to also tell it to use port 9090 where the data is. If I tell it to use a different port, it will not see the ROSBridge Data. Unfortunately, it seems that two processes can't use the same port. That, or I'm getting some other problem that I'm not aware of. It works fine, however, if my Unity app is on a different PC. I know nothing of unicast or multicast.
– CodeMonkey
Jan 16 at 16:40
As for dbus, I'm utilizing pre-made packages where you simply select the port to use. It seems I may have to modify them though to get what I need...
– CodeMonkey
Jan 16 at 16:42
add a comment |
Not sure what you mean by "forward" in this case, since traffic originating at 9090 is sent (not forwarded) to 9091. If you have traffic from process X on port 8500 that must be sent to both A and B, send one message to each independently, no forwarding. TCP is a unicast (not multicast) protocol.
– user535733
Jan 16 at 16:04
Generally, interprocess communication in Ubuntu is handled by dbus, which is already installed, and has lots useful features, and lots of bindings available. Look it up. Feel free to use it, that's what it is there for, You can implement your own, of course, using pipes, named pipes, sockets, shared files, and other methods, if you wish - use of dbus is merely convenient, not required.
– user535733
Jan 16 at 16:06
It's possible (and perhaps likely) that I just don't understand ports. When I launch my ROSBridge node, I tell it to use port 9090 for sending/receiving data. My other process, Unity, needs to send and receive data from ROSBridge so I need to also tell it to use port 9090 where the data is. If I tell it to use a different port, it will not see the ROSBridge Data. Unfortunately, it seems that two processes can't use the same port. That, or I'm getting some other problem that I'm not aware of. It works fine, however, if my Unity app is on a different PC. I know nothing of unicast or multicast.
– CodeMonkey
Jan 16 at 16:40
As for dbus, I'm utilizing pre-made packages where you simply select the port to use. It seems I may have to modify them though to get what I need...
– CodeMonkey
Jan 16 at 16:42
Not sure what you mean by "forward" in this case, since traffic originating at 9090 is sent (not forwarded) to 9091. If you have traffic from process X on port 8500 that must be sent to both A and B, send one message to each independently, no forwarding. TCP is a unicast (not multicast) protocol.
– user535733
Jan 16 at 16:04
Not sure what you mean by "forward" in this case, since traffic originating at 9090 is sent (not forwarded) to 9091. If you have traffic from process X on port 8500 that must be sent to both A and B, send one message to each independently, no forwarding. TCP is a unicast (not multicast) protocol.
– user535733
Jan 16 at 16:04
Generally, interprocess communication in Ubuntu is handled by dbus, which is already installed, and has lots useful features, and lots of bindings available. Look it up. Feel free to use it, that's what it is there for, You can implement your own, of course, using pipes, named pipes, sockets, shared files, and other methods, if you wish - use of dbus is merely convenient, not required.
– user535733
Jan 16 at 16:06
Generally, interprocess communication in Ubuntu is handled by dbus, which is already installed, and has lots useful features, and lots of bindings available. Look it up. Feel free to use it, that's what it is there for, You can implement your own, of course, using pipes, named pipes, sockets, shared files, and other methods, if you wish - use of dbus is merely convenient, not required.
– user535733
Jan 16 at 16:06
It's possible (and perhaps likely) that I just don't understand ports. When I launch my ROSBridge node, I tell it to use port 9090 for sending/receiving data. My other process, Unity, needs to send and receive data from ROSBridge so I need to also tell it to use port 9090 where the data is. If I tell it to use a different port, it will not see the ROSBridge Data. Unfortunately, it seems that two processes can't use the same port. That, or I'm getting some other problem that I'm not aware of. It works fine, however, if my Unity app is on a different PC. I know nothing of unicast or multicast.
– CodeMonkey
Jan 16 at 16:40
It's possible (and perhaps likely) that I just don't understand ports. When I launch my ROSBridge node, I tell it to use port 9090 for sending/receiving data. My other process, Unity, needs to send and receive data from ROSBridge so I need to also tell it to use port 9090 where the data is. If I tell it to use a different port, it will not see the ROSBridge Data. Unfortunately, it seems that two processes can't use the same port. That, or I'm getting some other problem that I'm not aware of. It works fine, however, if my Unity app is on a different PC. I know nothing of unicast or multicast.
– CodeMonkey
Jan 16 at 16:40
As for dbus, I'm utilizing pre-made packages where you simply select the port to use. It seems I may have to modify them though to get what I need...
– CodeMonkey
Jan 16 at 16:42
As for dbus, I'm utilizing pre-made packages where you simply select the port to use. It seems I may have to modify them though to get what I need...
– CodeMonkey
Jan 16 at 16:42
add a comment |
1 Answer
1
active
oldest
votes
It sounds like my understanding about ports was lacking. The host for the ROSBridge is being set up to use port 9090 so that anyone wishing to connect to it will request the host's port 9090 for the connection but will still use whatever port it desires on its own side. In both applications, I can state that the "Host" port is 9090 without conflict because the client application will still open a random other port for its own use to connect to the host port. Therefore, the trouble I am experiencing is something other than "port sharing" since that is not what is happening. Only one is hosting on 9090.
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
CodeMonkey is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1110285%2fforwarding-traffic-from-one-port-to-another-and-vice-versa%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It sounds like my understanding about ports was lacking. The host for the ROSBridge is being set up to use port 9090 so that anyone wishing to connect to it will request the host's port 9090 for the connection but will still use whatever port it desires on its own side. In both applications, I can state that the "Host" port is 9090 without conflict because the client application will still open a random other port for its own use to connect to the host port. Therefore, the trouble I am experiencing is something other than "port sharing" since that is not what is happening. Only one is hosting on 9090.
New contributor
add a comment |
It sounds like my understanding about ports was lacking. The host for the ROSBridge is being set up to use port 9090 so that anyone wishing to connect to it will request the host's port 9090 for the connection but will still use whatever port it desires on its own side. In both applications, I can state that the "Host" port is 9090 without conflict because the client application will still open a random other port for its own use to connect to the host port. Therefore, the trouble I am experiencing is something other than "port sharing" since that is not what is happening. Only one is hosting on 9090.
New contributor
add a comment |
It sounds like my understanding about ports was lacking. The host for the ROSBridge is being set up to use port 9090 so that anyone wishing to connect to it will request the host's port 9090 for the connection but will still use whatever port it desires on its own side. In both applications, I can state that the "Host" port is 9090 without conflict because the client application will still open a random other port for its own use to connect to the host port. Therefore, the trouble I am experiencing is something other than "port sharing" since that is not what is happening. Only one is hosting on 9090.
New contributor
It sounds like my understanding about ports was lacking. The host for the ROSBridge is being set up to use port 9090 so that anyone wishing to connect to it will request the host's port 9090 for the connection but will still use whatever port it desires on its own side. In both applications, I can state that the "Host" port is 9090 without conflict because the client application will still open a random other port for its own use to connect to the host port. Therefore, the trouble I am experiencing is something other than "port sharing" since that is not what is happening. Only one is hosting on 9090.
New contributor
New contributor
answered yesterday
CodeMonkeyCodeMonkey
1013
1013
New contributor
New contributor
add a comment |
add a comment |
CodeMonkey is a new contributor. Be nice, and check out our Code of Conduct.
CodeMonkey is a new contributor. Be nice, and check out our Code of Conduct.
CodeMonkey is a new contributor. Be nice, and check out our Code of Conduct.
CodeMonkey is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1110285%2fforwarding-traffic-from-one-port-to-another-and-vice-versa%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Not sure what you mean by "forward" in this case, since traffic originating at 9090 is sent (not forwarded) to 9091. If you have traffic from process X on port 8500 that must be sent to both A and B, send one message to each independently, no forwarding. TCP is a unicast (not multicast) protocol.
– user535733
Jan 16 at 16:04
Generally, interprocess communication in Ubuntu is handled by dbus, which is already installed, and has lots useful features, and lots of bindings available. Look it up. Feel free to use it, that's what it is there for, You can implement your own, of course, using pipes, named pipes, sockets, shared files, and other methods, if you wish - use of dbus is merely convenient, not required.
– user535733
Jan 16 at 16:06
It's possible (and perhaps likely) that I just don't understand ports. When I launch my ROSBridge node, I tell it to use port 9090 for sending/receiving data. My other process, Unity, needs to send and receive data from ROSBridge so I need to also tell it to use port 9090 where the data is. If I tell it to use a different port, it will not see the ROSBridge Data. Unfortunately, it seems that two processes can't use the same port. That, or I'm getting some other problem that I'm not aware of. It works fine, however, if my Unity app is on a different PC. I know nothing of unicast or multicast.
– CodeMonkey
Jan 16 at 16:40
As for dbus, I'm utilizing pre-made packages where you simply select the port to use. It seems I may have to modify them though to get what I need...
– CodeMonkey
Jan 16 at 16:42