chentingpc
chentingpc

Reputation: 1283

netty- how to transmit message and data together?

I mean like this:

In client side, a user input a file name, the client transmit the message of asking for the file to server, and server search for the file, if the file found, transmit a message to client for notification first, and then transmit the file's data to the client, if the file is not exist in server, just send back a notification message.

Since there are message and data in the transmission, how could I decoder them? Could anyone help me with that, if with some example code would be great help!

Upvotes: 0

Views: 202

Answers (1)

Veebs
Veebs

Reputation: 2388

Are you using HTTP? You can use the HTTP status code for the notification, and the response content for the data.

There are plenty of Netty HTTP example apps.

Using HTTP may save you from having to invent your own protocol.

Upvotes: 1

Related Questions