You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Bagwell, Allen F" <af...@sandia.gov> on 2017/11/15 21:30:26 UTC

using netty4 to set up a UDP client with a particular binding port

I have an intriguing problem with trying to set up a simple Netty4 endpoint in Camel.

The URL is simple enough:

netty4:udp://X.X.X.X:30500?udpByteArrayCodec=true&requestTimeout=15000&connectTimeout=10000

This is using request-reply and so I expect to get a message returned back to me and that response will continue along the route.

However the server I'm talking to (and that I have no control over), accepts the message and sends back the response using the same port on my local machine that the UDP client was bound to. So in the example above, for instance, is the port 23400 was randomly picked as my locally bound port to establish the client, the server on the other end will read this out of the UDP packet and send the response message back to port 23400 on my machine.

The problem is that these messages need to pass through a firewall that only has a small range of ports open for inbound messages to my client. So if the server responds back trying to reach port 23400 on my machine and it's not in the range allowed by the firewall then the response never reaches me.

To get around this, the people who maintain the server have said I need to set my locally bound port on the client to a number in the port range that will be allowed through when the response comes back. So if port 25000 is in the range, that is the socket my Netty client has to bind to when instantiated. I've been searching for how to do this within the code examples for Camel/Netty but can't find what I need.

Is this even possible with Camel/Netty? And if not, what other alternatives are available?

Thanks,
-Allen

Re: using netty4 to set up a UDP client with a particular binding port

Posted by Claus Ibsen <cl...@gmail.com>.
Good question.

Camel can only do what Netty can do, so you should first find out what
is possible with Netty. If its possible then you can configure
camel-netty in many ways, and if something is missing to set that port
range, you are welcome to dive into the source code and provide a PR

On Wed, Nov 15, 2017 at 10:30 PM, Bagwell, Allen F <af...@sandia.gov> wrote:
> I have an intriguing problem with trying to set up a simple Netty4 endpoint in Camel.
>
> The URL is simple enough:
>
> netty4:udp://X.X.X.X:30500?udpByteArrayCodec=true&requestTimeout=15000&connectTimeout=10000
>
> This is using request-reply and so I expect to get a message returned back to me and that response will continue along the route.
>
> However the server I'm talking to (and that I have no control over), accepts the message and sends back the response using the same port on my local machine that the UDP client was bound to. So in the example above, for instance, is the port 23400 was randomly picked as my locally bound port to establish the client, the server on the other end will read this out of the UDP packet and send the response message back to port 23400 on my machine.
>
> The problem is that these messages need to pass through a firewall that only has a small range of ports open for inbound messages to my client. So if the server responds back trying to reach port 23400 on my machine and it's not in the range allowed by the firewall then the response never reaches me.
>
> To get around this, the people who maintain the server have said I need to set my locally bound port on the client to a number in the port range that will be allowed through when the response comes back. So if port 25000 is in the range, that is the socket my Netty client has to bind to when instantiated. I've been searching for how to do this within the code examples for Camel/Netty but can't find what I need.
>
> Is this even possible with Camel/Netty? And if not, what other alternatives are available?
>
> Thanks,
> -Allen



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2