NCNecros
NCNecros

Reputation: 2415

How i can open new client channel inside server handler to other address

I use netty. In may application i process inсoming packets, but i need send parsed packet in other server and should return to the incoming flow of the result of processing the package third-party server; How i can open new connection inside server hadler for send packet to third-party server and read result?

Upvotes: 0

Views: 106

Answers (1)

Brian Roach
Brian Roach

Reputation: 76918

The same way you would write a client with netty.

Netty client example: http://static.netty.io/3.6/guide/#start.9

You'd need to use the ClientBootstrap to set up a new bootstrap, create a pipeline factory, handlers, etc, etc.

In all honestly, that's probably a bit overkill unless you really need it to be async, which is sounds like you don't. If it's just a REST service or something similar you need to access, I'd just use a plaid old HttpUrlConnection and get what you need synchronously.

Upvotes: 1

Related Questions