A little byte[] problem

Hi,
I'm facing an unusual problem with creating an array of byte arrays, ie byte[][].
Below is my test code to create this array and read it back. For some reason this is not working. I'll definitely use some knowledge here. Thanks
import java.io.*;
public class Test {
   static byte[][] testbyte = new byte[10][3];
   public static void main(String[] args) {
           ByteArrayOutputStream bout = new ByteArrayOutputStream();
           DataOutputStream dout = new DataOutputStream(bout);
           try {
             for(int m=0;m<3;m++){
               for (int i = 0; i < 10; i++) {
                 dout.writeInt(i*m);
               testbyte[m]=bout.toByteArray();
          for(int index=0;index<3;index++){
            ByteArrayInputStream bin = new  ByteArrayInputStream(testbyte[index]);
            DataInputStream din = new DataInputStream(bin);
            int m = 0;
            while (m < 10) {
               System.out.println(din.readInt());
                m++;
       catch (IOException ex) {
       System.out.println(ex);
}

Actually I send one row of data at a time - thatis
ony 8bytes * 4 = 32 bytes. If you are only send 4 doubles at a time, do you
need to keep all the previous values.
Sending 32 bytes every 10 ms should not be a
problem.
To do this I use DatagramPacket with an offset onthe byte array which
increments by 32 and a length of 32 bytes. If the byte array only contained the data you need to
send this would much simpler.
Note, toByteArray() creates a new byteArray copy of
the data in the ByteArrayOutputStream so it could be
copying around alot of data you don't need.I call toByteArray() only once. After the array is created I do something like DatagramPacket packet = new DatagramPacket(myByteArray,offset,length,address,port)
I'll try tcp as well though I anticipate the speedwill be much lower.
If you keep the socket connection open, then the
speed will be the same, except it will also be much
more reliable. Only the connection latency is slower.
However on a LAN this should less than 0.3 ms once
off.I'll definitely try this. Thanks for the headsup on the reason for the tcp latency. I though each send-receive transaction had to be ack'ed.

Similar Messages

  • Little "big" problem with Reports 9i...

    Hi to all.
    I've a little "big" problem when i launching reports on the web. The reports services it's under SUN Solaris 5.9 and de 9iAS 9.0.2. Well when i launch the report the reports server give me this error: "REP-108: File '/tmp/pfj66590734.gif' not found.".
    The report have a chart, and the chart it's the problem, if i delete the graph(chart) the report run fine. In the Reports Server file config in the tmpDir, have specified this directory but, not find the gif.
    Can be a problem of the chart with the reports engine?
    I don't know.
    Anybody have which that's the problem.
    Thanx in advance. Oscar.

    I was facing the same problem when running a report with embedded chart graphics, and every time we tried running it we got an error message like the one below, where the gif file name changed every time:
    REP-108: File 'd:\ora9ias\reports\temp\pfj30143486.gif' not found
    Our solution was:
    After a lot of research and troubleshooting we found out that if we compiled the report in a different machine (the developers') and deployed to the server it worked fine, the problem was the settings (registry and path variables) in the machine that was compiling the report (Our software release machines). I can't say exactly what were the settings changes right now, but try under someone else's machine, its the configuration of reports builder.
    Hope this helps.

  • I have a little bit problem with verify my apple ID, I don't get any message for verification aplle ID from Apple. Why? Anyone can help me

    Dear all,
    I have a little bit problem with verify my apple ID, I don't get any message for verification aplle ID from Apple. Why? Anyone can help me

    Hi Tep Virak,
    Thanks for visiting Apple Support Communities.
    You may want to log into your Apple ID first to double-check that it's the right email address and re-send the verification email using these steps:
    Sign in to My Apple ID to manage your account information.
    Click Resend under Primary Email Address.
    From:
    Apple ID: Associating and verifying email addresses with your Apple ID
    http://support.apple.com/kb/he68
    All the best,
    Jeremy

  • Base64Binary to byte[] problem in Wireless Toolkit and NetBeans

    Hi,
    I am generating stub with J2me Wireless toolkit. But the problem is that the toolkit can't successfully convert base64Binary to byte[] and gives error "Unknown simple type byte[]". Netbeans also gives some error while compiling it. Please anybody tell me how can i resolve this problem. Using base64Binary type is must.
    Kindly reply if you know. My email address is [email protected]
    Wasif Ehsan
    [email protected]

    public interface JobUpdate {
         @SuppressWarnings("unchecked")
         public String[] getUpdatedJobList(@WebParam(name="phoneJobs")String[] phoneJobs);
         @SuppressWarnings("unchecked")
         public void retrieveJobsWorked(@WebParam(name="data")byte [] data);
    I then use this to start the service
    JobUpdateImpl implementor = new JobUpdateImpl();
              JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
              svrFactory.setServiceClass(JobUpdate.class);
              svrFactory.setAddress("http://localhost:9000/JobUpdate");
              svrFactory.setServiceBean(implementor);
              svrFactory.getInInterceptors().add(new LoggingInInterceptor());
              svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
              svrFactory.create();
    Then use the wtk stub generator pointing at the service.
    http://localhost:9000/JobUpdate?wsdl
    The error returned by the tool is error: Found unknown simple type: byte[]
    Any ideas?

  • InetAddress.getByAddress(byte[]) problem...

    the following line of code is not compiling for me.
    InetAddress inAd = InetAddress.getByAddress(IAbyte);where IAbyte is an byte array of length 4 where each byte is the component of an IP address.
    I am recieving the error:
    C:\tmp\FTPServer,java.java:507: cannot resolve symbol
    symbol : method getByAddress (byte[])
    location: class java.net.InetAddress
                   InetAddress inAd = InetAddress.getByAddress(IAbyte);
    Which is quite odd as the API http://java.sun.com/j2se/1.4.1/docs/api/java/net/InetAddress.html#getByAddress(byte[]) says that the method should be there.
    Knowing me it is just a silly little error on my part ^_^;

    Which is quite odd as the API http://java.sun.com/j2se/1.4.1/docs/api/java/net/InetAddress.html#getByAddress(byte[]) says that the method should be there.
    yes its right
    by the way which version of jdk r u using ...

  • Bytes problem over RS232

    Hello!
    I'm trying to send data between to computer using RS232.
    The problem I encounter is the following:
    when I send data from 0 to 127 they are well received.
    from 128 to 160 they are bad received (actually 130 is received as 8218, 131 as 405, 135 as 8225).
    from 160 to 255 they are well received.
    I know that bytes in Java are from -128 to +127 and I could understand that number greater than 127 have problems to be transmitted, but because of those 160 to 255 numbers that are well received, I don't get it.
    I tried to find a pattern with the association of number sent and received between 128 and 160 but I didn't find anything relevant...
    I'm using a simple RS232 cable via an USB to RS232 converter on my computer (I don't have any serial port) while the other computer is directly using its RS232 port.
    The port is configured to send data to 9,6kbps, no parity bits, 1 stop bit and 8 data bits.
    Has anyone any idea of where my problem could come from?
    I get really confused with that...
    By the way, if some admins wants to put my post somewhere else because here is not the appropriate place, I totally understand it but could he (or she?) just mail to tell me where it has been put, because last time I posted I didn't find it anymore... lol
    Thanks ;)

    Please help me!
    finally I cannot even write a conversion algorithm because different values return the same value (sounds odd but here it is:)
    Send Receive
    127 127
    128     8364
    129     65533
    130     8218
    131     402
    132     8222
    133     8230
    134     8224
    135     8225
    136     710
    137     8240
    138     352
    139     8249
    140     338
    141     65533
    142     381
    143     65533
    144     65533
    145     8216
    146     8217
    147     8220
    148     8221
    149     8226
    150     8211
    151     8212
    152     732
    153     8482
    154     353
    155     8250
    156     339
    157     65533
    158     382
    159     376
    160 160
    As you can see for example 143 and 144 both return 65533...
    What can I do?

  • Can anyone help me with a little display problem in IE7 please?....

    I have just uploaded a new site which has been created using Dreamweaver CS4 for Windows.  There is no problem viewing the site in IE 8, or in Firefox.
    The site is basically a gallery of images.  For some of the main images I've used little magnifying glass 'plus' symbols, which are simply linked rollover png images that take you to a larger version of the image.  In IE7 (and I presume in older versions too) these little symbols aren't displaying in the correct position on each of these pages, they've jumped and are incorrectly displaying over the top, left corner of the main image.
    Here's the link:
    www.sjcillustration.com
    Firstly, why is this happening in IE7 and yet all's fine in IE8 or in Firefox, and secondly, can anyone tell me how to fix it please?
    (I was going to attach the corresponding CSS file but don't see an attach file button.......)
    Cheers!

    Hi Cristian, thanks for responding so speedily!
    On the homepage, click on the 'diagrammatic' thumbnail for example, then click on the 'volcano' thumbnail, when the volcano page appears, you should see the little magnifying glass plus rollover image under the main image to the right.   As I said, on these specific pages, in IE 7 the symbol jumps to the top left of the main image.
    For your info, I have seen this problem on my older XP pc, which runs IE 7.  All is fine on my newer Vista pc, which is using IE8 & Firefox.
    Maj

  • Little WiFi problem/projecy

    Hi,
    I've got a little problem. I have to install a small network in my basement, but my cable modem is on the 2nd floor and i can't move nothing.
    On the 2nd floor, i have a WiFi router connected to the modem.
    Now i want to connect another WiFi router (maybe configured as a AP) to the WiFi router on the 2nd floor.
    Diagram :
    (modem) --cable-- (WiFi router 1) << wireless >> (WiFi Router 2) --cable-- (PC)
    Is this possible ?
    I have a DLink DIR-655 and Linksys WRT54GX2.

    No.  You must connect the two routers via an ethernet cable to do what you want.  However, 3rd party firmware can connect them wirelessly, but I don't not know if D-Link can do this.  Check for DD-WRT firmware to handle both routers.

  • HP phoenix 1183 little boot problem

    Hi,
    I bought an hp phoenix 1183 a few months ago. Now i am experiencing a strange problem for  3-4 days now. When I open my computer, it boots up fast in like 10-15 sec because of the SSD and  just after entering the home screen, it freezes for 2-3 min and then it runs like a charm like nothing happenned. It close fast like it was new i just have this little problem when it starts it freeze at the home screen for a few minutes and then works fine. I analyzed my system with antivirus, i got nothing. I installed intel SSD toolbox, my health is 100%, SMART and everything is ok. I never did an update of any driver I use the factory drivers and so far until this I never got that problem. Three weeks ago, i upgraded my ram and I checked everything if its compatible and it worked like a charm, it's same speed 1333mhz ddr3 240 pin Kingston, I checked on the internet to see if it works with this model and I checked the supported RAM on the motherboard before upgrading. I am pretty sure that it is not because of the RAM because it works fine and windows recognize it and everything, and in plus, this problem happened to me a few times before I upgraded my ram (I thought back then that it was only a windows bug).  I am also pretty sure that the ram is not deffective because it never failed and I got no hardware errors. So what is it?
    Thanks you for your answers
    Vlad

    Hello alexjedicool.  I understand you're having some issues with your computer hanging.  Also, I like your name!
    A good first step will be to run a diagnostic on the RAM just in case.  You'll want to create some bootable media to run the MemTest application.
    Also, I'd like you to run a check on your computer's system files.  Try the following.
    Click Start, type "cmd," and press Enter.
    Type the "sfc /scannow" command and press Enter.
    Allow the process to complete.
    Post the results.
    Also, what is your computer's product number?  This document can show you where it is located.
    Have a wonderful day!
    Please click the white star under my name to give me Kudos as a way to say "Thanks!"
    Click the "Accept as Solution" button if I resolve your issue.

  • Little Snitch Problems / Trail software Problems

    Hello all, I'm not sure if this is the right place to post this question but it's the best I could find.
    I recently downloaded two trial softwares. Little Snitch, and AstoundStereo, both from the Apple site. I decided against using both of them and deleted them before the trail ran out. Problem is, I'm still receiving annoying alerts from both programs, even though no trace of them (that I can see) remains on my computer.
    Little Snitch will pop up and tell me my 3 hour trial has expired (it expired a few weeks ago) and AstoundStereo is still counting down the days left in its trial, despite both these applications being uninstalled.
    Anybody know how I can fix this problem?
    Any help greatly appreciated thank you

    Hi
    AstoundStereo - per the developer, run the uninstall program located in the AstoundStereo Expander folder, which is within the Applications folder. If you deleted that folder, download another copy of the software and open the installer. Either you'll be able to uninstall it from there, or you'll need to install the app. again so you can uninstall it.
    Little Snitch - uninstall directions here.

  • Curious little usb problem

    :? I'm just about finished installing ARCH and I have a curious
         little problem. At boot I was getting this message after the
          mounting file systems section:
                   " mount: mount point /proc/bus/usb does not exist ".
         I didn't pay much attention, but when running hwd -s it
         reported I had a usb module available - usb-uhci. Not
         knowing any better I put it in the module section of rc.conf.
         Now I'm also getting:
                    "Fatal: module usb-uhci not found"
         after the modules loaded section at boot up. The system
         works ok, sort-of. Anybody know how to fix the usb problem?
         I did have a usb mouse, but I had  to connect to a ps2 port to get
         it to work. Oh well, I still love linux anyway. -Thanks - Larry

    lmellen wrote: Thanks Pajaro, I changed the usbdefvs to usbfs and the error messages are gone. My mouse still won't work in the usb port, but that might be a set up problem. Again --Thanks for the assistance!!
                                                                                    Larry   
    Plug it in and check the output of dmesg. If it's recognized, it's probably a typo in your X.org config file (I assume it doesn't work in X).

  • Type byte problem !!!

    private DatagramPacket receivePacket;
    private DatagramSocket socket;
    public class receive {
    public receive() {
    try {
    socket = new DatagramSocket( 1002 );
    catch( SocketException se ) {
    se.printStackTrace();
    System.exit( 1 );
    public void waitForPackets() {
    while ( true ) {
    try {
    byte data[] = new byte[ 2048 ];
    receivePacket = new DatagramPacket(
    data, data.length );
    socket.receive( receivePacket );
    catch( IOException exception ){
    System.out.print(
    exception.toString() + "\n" );
    exception.printStackTrace();
    add watch the byte data[] found that
    some data[] such as data[1] data[7]
    over 8 bit and neg value occured
    why ? help me !
    data: byte[2048] = {...}
    data[0]: byte = 0x0
    data[1]: byte = 0xffffff87
    data[2]: byte = 0x36
    data[3]: byte = 0x0
    data[4]: byte = 0x0
    data[5]: byte = 0x4
    data[6]: byte = 0x1
    data[7]: byte = 0xffffff9c
    data[8]: byte = 0x3
    data[9]: byte = 0x24
    data[10]: byte = 0xffffff80
    data[11]: byte = 0x16
    data[12]: byte = 0x58
    data[13]: byte = 0x4e
    data[14]: byte = 0x2

    i manage to walkaround the problem...
    just in case someone is interested:
    i convert the image to greyscale using colorspace instead of defining the BufferedImage to bt of TYPE_BYTE_GRAY.
    Here's the code:
                 image = ImageIO.read(file);
                 bI = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);
                 pic = bI.createGraphics();
                 pic.drawImage(image, 0, 0, null);
                 pic.dispose();
                 ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
                      ColorConvertOp op = new ColorConvertOp(cs, null);
                  bI = op.filter(bI, null);
                 i  = new ImageIcon(Toolkit.getDefaultToolkit().createImage(bI.getSource()));
                 b1 = new JButton("ColorSpace", i);            
                 frame.getContentPane().add(b1);     

  • Little execution problem with the script

    declare
    i number(1):=1;
    name varchar2(10);
    id number(2);
    begin
    loop
    id:=&id;
    name:='&name';
    insert into emp values(id,name);
    i:=i+1;
    exit when id<=5;
    end loop;
    end;
    When i tried to execute the script, it is going through the loop only once..What the problem with this script...Can any body help the script work?

    if id is less or equal to 5 then loop will execute only once.
    What is the variable i for ?

  • Same but a little different problem with iPod

    I installed my iPod shuffle and everything worked great. Then I tried to recharge it and now I have the same blinking light problem that everyone else has described. My difference is that my iPod is recognized in iTunes, but not recognized by Windows. My computer only shows it as a mass storage devise. When I try to restore the iPod, I get a "Firmware update failure. Disk write error" notice.
    Can someone please give me some direction??
    Thanks.
    Dell laptop   Windows XP  

    Don't be concerned that Windows doesn't recognize your Shuffle. I support two Shuffles with my computer, and when they're plugged-in (one at a time) they only show up under Control Panel/System/Device Manager/Disk Storage/Apple iPod USB Device -- they're not assigned a drive letter. Now, are you trying to charge your Shuffle with iTunes open? If so, try charging with iTunes closed, and the Shuffle turned OFF. The Status light may flash for 30 seconds or so but then it should go steady.
    Roger

  • Tricky little JScrollPane problem

    I have a JScrollPane that contains a JPanel with BorderLayout called "mainPanel".
    I have a kind of web appearance with a left child panel of vertical JLabels, a north child panel for title, and a center child panel as a work area inserted into "mainPanel". Simple enough!
    The problem is in the center panel, when I insert a child JPanel into it with either FlowLayout or VerticalFlowLayout withthe panel extending completely across the center panel from left to right.
    This child panel is hidden-to-the-eye panel because of the background being color same as center panel.
    I then add controls to the child panel.
    The problem is the scrollbars appear for the child panel that extends the full width of the center panel, instead of the controls, which I DONT want. I want the scrollbar to only show for the controls.
    How can I get JScrollPane to ignore child JPanels like it does with the top level JPanel "mainPanel".
    thanks

    There's a post around from a couple of years ago where I tried to get flowlayout to behave in a scrollpane. I got it to work fairly well, but eventually gave up. I think the real answer is to not use flowlayout in a scrollpane, but you can search for that post if you want.

Maybe you are looking for

  • File to file using bpm

    Kindly help in this regards.. its a file to file Bpm collect message scenario 1) my ? is i am having two sender data types i combined in message mapping and mapped to target structure but when i want to send file how can i send two diffrent files.   

  • Flash player 10.3

    My flash player stopped working/disapeared.  I am using vista 64 so I can't download the latest version.  I have tried downloading 10.3 via various routes from your web site but have not been successful.  I had google chrome but I think I have now un

  • Resolution wrong at startup and after sleep

    I have a one display: a Cornea with a max resolution of 1280 X 1024 and 60 Hz. Lots of times at startup and almost always after waking up from sleep the resolution is reset to 1152 X 870. When I "detect displays" it resets correctly. What's the probl

  • Changing from "Pass Through" as Default in Blend Mode in a Group Folder Layer Set

    Hello Forum gurus! Using a MacBook Pro, 10.5.4. Painting with CS2. My question is two-fold. When the Group layer folder in a layer set is selected, it is displaying the "Pass Through" blend mode by default. Is there a special convenience to this? (Be

  • 10.4.6 - no permissions need repair?

    alright, maybe this isn't a problem, per se, but it is odd. i've noticed on three computers so far, after updating to 10.4.6, repairing permissions finds nothing to repair! it used to always need to change some widgets permissions or dvd player or so