0

I am using apache mina for client socket application where I want to use input streams and output streams for sending or reading data instead of using IO sessions. How can I write data to a server using streams? If possible please provide a small example.

Please help me with your answers. Thanks in advance

Rocky
  • 129
  • 2
  • 12
  • Please use the apache tag for question focussed on the HTTP server only. – f_puras Sep 13 '12 at 09:52
  • Why you want to use input/output streams, what is the purpose of using MINA then ? – Umer Hayat Sep 13 '12 at 10:29
  • I must send data to server in hexadecimal format for that I am assuming that we must use streams to send data as I am unable to send data in hexa format correctly using IO sessions. – Rocky Sep 13 '12 at 10:43
  • I removed tha apache tag..... thks for your suggestion....f_puras – Rocky Sep 13 '12 at 10:44
  • What do you men by hexadecimal format? You can send data in binary form using Iosession, you can do whatever you want with it – Umer Hayat Sep 13 '12 at 10:59
  • Here my server is a gateway which reads data from the current meters. The gateway can understand only hexa format so I need to send data in hexa format. For hexadecimal format refer this [link] (http://en.wikipedia.org/wiki/Hexadecimal) – Rocky Sep 13 '12 at 11:48
  • @Rocky So put your data into whatever format you need and send it. You don't need a stream to do that. The MINA API can do that. Not a real question. – user207421 Sep 14 '12 at 22:50

1 Answers1

0

Apache MINA is a non-blocking I/O framework. Streams are a blocking I/O framework. You need to make up your mind which it is that you want: you can't have both at the same time.

You certainly don't need to go into blocking mode just to send 'data in hexa format', whatever that is.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • so how can I send that data in hexa format. Please give a reference example. Thanks for your help – Rocky Sep 13 '12 at 11:51
  • @Rocky First you will have to tell us what you understand by 'hexa format', and then you will have to explain what problems you are having sending it with the Mina framework you are already using. Ultimately data is just bytes you know. – user207421 Sep 13 '12 at 13:22