Will
Will

Reputation: 75625

netty sever-to-server data streams

I have two Java netty servers that need to pass lots of messages between themselves fairly frequently and I want it to happen fairly promptly.

I need a TCP socket between the two servers that I can send these messages over.

These messages are already-packed byte[] arrays and are self-contained.

The servers are currently both running HTTP interfaces.

What is the best way to do this?

For example, websockets might be a good fit yet I am unable to find any websocket client examples in netty..

I'm a netty newbie so would need some strong simple examples. It surely can't be so hard?!

Upvotes: 0

Views: 440

Answers (1)

Eero Aaltonen
Eero Aaltonen

Reputation: 4425

Since you mentioned HTTP, you could look at the HttpStaticFileServer in the examples.

When established, a TCP connection is a Channel. To send your messages, you need to write them to a ChannelBuffer and call channel.write.

Of course, this does not cover message borders. The Telnet example shows a case, where the messages are delimited by the newline character.

Upvotes: 1

Related Questions