• Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting Data Types

 
Gerry Martin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My java app recieves data over TCP/IP from a C++ app. I am to recieve approx 1.5 million data points per second. Problem is that the C++ app wants to send this data as uint4.
What is an effiecient way to do this transfer and conversion? Would changing the C++ app to send bytes be the most efficient?
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, this may be clueless on my part, but is uint4 unsigned integer using 4 bytes? or is it unsigned int using 4 bits?
If its bits, it might be easier to send bytes since you would have to split every "byte" of info coming in and make 2 values... and doing that at the data rate you want may be too many steps to handle without slowing your app down too much.
if its bytes, why not just use int values?
I may be totally misunderstanding what you want to do, tho... 1.5 mil pieces of data/sec sounds like alot for java to do anything with if it's coming in at a constant rate
[ June 07, 2002: Message edited by: Chris Shepherd ]
 
Gerry Martin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
uint4 is unsigned integer, 4 bits.
My app just takes the data as an array and displays it using create memory image, using an indeccolormodel. Using 100BaseT network, should be able to transfer 6Mbytes/sec. Do you think the overhaed java imposes won't be able to handle this transfer rate.
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmmm smallest java can do natively is byte. anything smaller and you are having to write custom objects and converters to split the incoming bytes(as java will read it) and make each one into 2 native byte variables. Seems like I remember java having bit shifters somewhere, but I could be wrong.
Of course you could just use "&" to clear the bits you didn't want, but you would still have to shift your 4 high bits down and account for negative values.
I think you would be better off passing in the values as bytes if you can. It sounds like you should be able to handle the doubled bandwidth needed, and it would save you time on the java side since you wouldn't need to convert anything.
I don't know what you need to pass to create the memory image. Does it work off bytes? or does it require a double?
I also don't know if java can do that display rate continuously... You would almost have to set up a test to see if it could keep up. I think it will depend on speed of the computer running the program and how much you are having to process the incoming data.
Now that I think about it, I have run about 3k/sec through some of my apps and done some seriously heavy processing and multiple plot updating. It works fine, but if you drop down to a 400 Mhz laptop with plenty of memory, you can tell that its running a bit slower. Now I call for my data from a custom DLL that talks to the USB port, so I don't have to really do much to collect the data.
I don't know what if any overhead you are going to have to pull the data in from the network. You might try setting up a test to just pull the data in and time how long it takes to get a complete set for display... that should give you some idea if you are going to be able to even handle the data rate, much less the display update rate...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!