Sending character array (as a bytebuffer)

Hi,
I do have to send a udp packet, containing several variables, and the reciever aspects it as a character array ... (C++, cannot change this part!)
As far as I see it, I can only send ByteBuffers via DatagramPackets .
Has anyone a clue how I can convert a ByteBuffer into another Bytebuffer in a way so that the udp reciever gets it as if I had sent a character array instead ?!?
Or is there actually a character array udp sender ?!?
Any help is highly appreciated, big Thanx in advance,
~Carmela

sorry, wrong forum ... please disregard!

Similar Messages

  • Sending character array (as a bytebuffer) via udp

    Hi,
    I do have to send a udp packet, containing several variables, and the reciever awaits it as a character array ... (C++, cannot change this part!)
    As far as I see it, I can only send ByteBuffers via DatagramPackets via udp.
    Has anyone a clue how I can convert a ByteBuffer into another Bytebuffer in a way so that the udp reciever gets it as if I had sent a character array instead ?!?
    Or is there actually a character array udp sender ?!?
    Any help is highly appreciated, big Thanx in advance,
    ~Carmela

    In C++, char' are unsigned bytes. Thus converting between bytes and chars is fairly straight forward. Java treats char as unsigned short (16-bit) so it converts chars to bytes as UTF-8. (By default) Unless you are using special on ascii characters i.e. 128+ all this makes no difference whatsoever.
    A bytebuffer is just a container for bytes. You can encode anything as bytes so there is no magic here. Just get the data as bytes and put it into a ByteBuffer.
    String string = "text";
    ByteBuffer bb = ByteBuffer.wrap(string.getBytes());

  • Character array type conversion problem

    Hi, I'm using BlazeDS (v3.0.0.544) to remotely call Java code on the server from my Flex client. I'm having trouble when converting a character array type from Java to ActionScript and vice-versa. In my Flex code, if the ActionScript class uses a String type to map to the char[] then the char[] is successfully converted from Java to ActionScript, but not from ActionScript to Java.
    // Extract from ActionScript code
    private var m_charArray:String;
    public function get charArray():String
    return m_charArray;
    public function set charArray(value1:String):void
    m_charArray = value1;
    Alternatively, if my ActionScript class uses an Array type then I can successfully send data from the client and populate a char[] field on the server, but can't send an updated char[] back to my ActionScript class.
    In fact the Flex console reports:
    TypeError: Error #1034: Type Coercion failed: cannot convert "myString" to Array.
    The code this time:
    // Extract from ActionScript code
    private var m_charArray:Array;
    public function get charArray():Array
    return m_charArray;
    public function set charArray(value1:Array):void
    m_charArray = value1;
    All the other types I have tried work successfully, it's only with char arrays that I've hit a problem.
    Any help would be appreciated, thanks.

    Hi Graeme,
    It is how it works. I can see the inconsistency. You can find an example how of echo char[] in blazeds\trunk\qa\apps\qa-regress\testsuites\mxunit\tests\remotingService\dataTypes\CharTy pesTest.mxml. It echos a char[] in return of a string. You can get the char in a string easily string.charAt() and get its length using length(). I think it may be the reason remoting decided to use a string to represent a char[] instead of a generic objects array. It should be more memory efficient. However, I can see that it can turn into problem as what you descibed. When the data has to send back to server, it has to convert back to array. If the char[] type is used inside an object, it is impossible to do the conversion unless the getter and setter are generic
    public function get charArray():Object
    return m_charArray;
    public function set charArray(value1:Object):void
    if (value1 is String)
    m_charArray = new Array();
    //copy the string elements to it
    else
    m_charArray = value1;
    I know it is ugly, but it the only work around I can think of. I think it needs to log a bug to correct this conversion behavior
    William

  • Using values to create a scatter plot in a character array

    Ok, I am fairly new to the language and i am working ona program that will first, get the users input of how many values and the x and y of each value, it will store it into a 2d array and also have the x-squared value and X*Y value. I have all the entry of the data working and the calculation for the line of best fit works correctly.
    What i need help with is, I want to take those values and store them into a character array that will display the points where they belong with a '*'. I also need to make the graph lines on the left and bottom. If the values are less than 10 for the x or y, i need to make them 10. The Y line needs to be rounded to the next highest 10s place if its over 10. I have tried a few things and i realised that it is completly wrong..
    public void graph(int[][] grid, int n)
                int highY = 0;
                for(int x=0;x<n; x++)
                 if (grid[x][1] > highY)
                    highY = grid[x][1];
             char[][] output = new char[n+1][highY+1];
             for(int z=0; z<highY+1; z++)
                 output[z][0]='+';
             for(int w=0; w<n+1; w++)
                 output[n][w]='+';
             int tempx=1; int tempy=1;
             output[tempx][tempy]='*';
             while(tempx<n+1)
                 tempy++;
                 if(tempy==highY+1)
                     tempx++;
                     tempy=0;
                 output[tempx][tempy]='*';
             System.out.println();
               for (int I=0; I<n+1; I++)
                      for (int J=0; J<highY+1; J++)
                          System.out.print(output[I][J]);
                          System.out.println();
    }Grid is the grid of the values, and for the [x][1] is all the Y values going down, [x][0] is the X values. the x would go up to however many values there are. Again, i know the code above is wrong.
    Any thoughts or suggestions would be appreciated. Also, if you need any more info from what i have done please ask.

    Big El,
    I think you can ditch the RGB To Color block, if that's what you're using.
    If I understand your description, what you need to do is use Interleave 1D Arrays to combine your three sine arrays together into one long array. Then use Draw Flattened Pixmap to turn the array into a picture. You can use Bundle By Name to stick your interleaved array into the image data cluster, and also make sure to specify 24-bit image depth and an appropriate bounding box.
    Hope that makes sense,
    John

  • Converting bytes to character array problem

    I am trying to convert a byte array into a character array, however no matter which Character Set i choose i am always getting the '?' character for some of the bytes which means that it was unable to convert the byte to a character.
    What i want is very simple. i.e. map the byte array to its Extended ASCII format which actually is no change in the bit represtation of the actual byte. But i cannot seem to do this in java.
    Does anyone have any idea how to get around this problem?

    Thanks for responding.
    I have however arrived at a solution. A little un-elegant but it seems to do the job.
    I am converting each byte into char manually by this algorithm:
              for (int i=0;i<compressedDataLength;i++)
                   if (((int) output)<0)
                        k=(127-((int) output[i]));
                        outputChr[i]=((char) k);
                   else
                        k=((int) output[i]);
                        outputChr[i]=((char) k);
                   System.out.println(k);
    where output is the byte array and outputChr is the character array

  • Send an array to php

    I have to send a large number of variable to php and want to
    avoid having to repeatedly call the php script, so I thought the
    way to do this would be to send an array. I generally use code
    similar to the following to receive individual variables in php:
    $count = mysql_real_escape_string($_GET["count"]);
    Unfortunately, I don't know how to accept an array from Flex
    into PHP. I realize that this is more of a php question than a Flex
    question, but am hoping that someone has done this before. Here's
    how I want to send the array from Flex:

    These links might help:
    link1
    link2
    link3

  • Using two dimensional character array in a Jolt-Tuxedo call

    Hi,
    I have a Tuxedo service that returns a two dimensional character array as follows:
    char airports[234][3] ;
    There are 234 rows and each row is a character array of 3 characters.
    When I call this service using Jolt, how can I access these in the Java program
    Can the getStringDef or getStringItemDef be used by any chance ?
    Thanks
    Bala.

    Hello Bala,
    R u using FML Buffers or Views???
    regards
    MS

  • HOW TO DO CHECKING BETWEEN THE CHARACTER ARRAY.

    hi all!!
    can any one please help me in checking the two character arrays.
    in my code i need to compare a character array(seq) to that of hydrob and hydrop . if the seq has hydrob then it should be given a different colour. if it has a hydrop then it should be assigned a different colour. if the sequence does not have a character that is neither in hydrob and hydrop then they shuld be given a separate colour.
    for (int i=0;i<seqlength;i++)//a for loop to get a letter
                char str1 = seq; // getting the first letter from
    for (int j=0;j<hydroblen;j++)//for loop to check the
    if (str1 == hydrob[j])//checking problem in here (suppose)
    res=1;//setting a value
    System.out.println("reach") ;
    repaint();//calling d paint function to paint in
    //System.out.println("reach") ;
    //j++;
    System.out.println("over") ;
    for (int i=0;i<seqlength;i++)
    char str2 = seq[i];
    for (int k =0;k<hydroplen;k++)
    while(str2==hydrop[k])
    res =0;
    repaint();
    k++;
    System.out.println("reach") ;
    i have compared them using this. but this is not much efficient which just paints the hydrophilic sequence lenght and paints the seq for that length of sequence.
    also the if loop in the paint function which have to do the paint for hydrob is not executing.
    if(res==1)
                gc.drawString(s, 700,700) ;// not executing the loop
                 for (int i =0;i<seqlength;i++)
               gc.drawString(s, 700,700) ;  //to check whether the loop s executing.
            for (int j=0; j<hydroblen;j++)
                x= x0 + radius*Math.sin(theta*(i));
    y[i]= y0 - radius*Math.cos(theta*(i));
    X[i] = (int) x[i];
    Y[i]= (int) y[i];
    gc.fillOval(X[j]-7,Y[j]-7,14,14);
    seq1 = seq[i] + "";
    hydrop1 = hydrop[j]+"";
    gc.drawString(seq1, X[i], Y[i]-8);
    gc.drawString("",X[j], Y[j]-8);
    gc.drawLine(X[j],Y[j],X[j+1],Y[j+1]);
    gc.setColor(Color.yellow);

    Hi Nitish,
    I think you might have to consult SAP for this. In one of my project experience, I had local currency related probled due to currency change in SAP R/3 during the fiscal year.
    I had a way out there, in a way that I dropped BW data with old currency and uploaded data with new currency and re-did the consoldiation starting from begining of the fiscal year. Unfortunatley, in your scenarios this is not possible
    During my discussion with SAP, I came to know that SAP do provide specific conversion consulting in BW BCS area as well.
    Hope this might help you.
    Best Regards,
    UR

  • Increase the length of a character array

    hello,
    i need to increase the length of my character array.i tred using ArrayUtils class which supports setSize method to set the size of a previously declared character array.But,i have no idea of how to import that class.i meant 'which package to use' for it. plz help me out of this
    thanks

    use ArrayList or StringBuffer or String Builder class.
    or
    use ArrayList to get the input at run time and use toArray() method to change the list to array.
    there is no option available to change the size of the array once created.
    there is no Arraysutils package , it is util.Arrays.
    u import,
    import java.util.*;
    or
    import static java.util.Arrays.*;

  • Filling character array with String

    I have character array of size 50. I have a string p="abcdef"
    I want to fill this String in char index ranging from 25-30(specific range).
    Is there any method to do this?? Please suggest me

    corlettk wrote:
    Ummm yeah... it's probably homework... Oops!
    </drops-and-gives-you-twenty> indeed ;-)
    But Hmmm... I've never understood educators universal compulsion to make students do things the hard way.I have no real problem with making students do things the hard way. In this case it looks to me to be an exercise in looping and accessing characters in a String. The OP will gain some knowledge by using the API but he will gain more by actually writing the detailed code himself.
    P.S. In the 'New To Java' forum I start with the assumption that everything is homework.

  • Sending a array of integer to client

    Hi all,
    I'm new to socket programming and i had read many tutorials on sending files from server to client using DataOutputStream. Is it possible to send a array of integer out using DataOutputStream? If so any example or tutorial that i can read on? Thanks.

    Alternatively, can i convert the array of integer to byte and transfer to the client and covert it back to array of integer again?
    Can someone help me with this?
    Example:
    //I have a array of integer
    testArray = new int[10];
    int i;
    for(i=0;i<10;i++) {
    testArray[i] = i;
    //I need some code to send this array of integer to a client.

  • How to compose an expression to display character array

    I have a non-\0 terminated dynamic character array stored in a custom (legacy company) datastructure that looks like this
    struct Str {
    char* buf;
    int size;
    I am trying to compose a natvis display for this:
    <Type Name="Str">
    <DisplayString> {XXX} </DisplayString>
    </Type>
    It looks quite straightforward, however, I wasn't able to get a clean expression for XXX.  I tried the following:
    {buf,sb} - does not work, as buf is not zero-terminated.
    {buf,size} - does not work since apparently size can not be dynamic
    {(wchar(*)[size])buf} - does not work for the same reason, and also [] produces array visualization (not string)
    Any ideas how to produce a clean string expression out of this stuct?
    Thanks

    Hi slymz,
    If possible, please refer to the following documents here:
    https://msdn.microsoft.com/en-us/library/jj620914.aspx?f=255&MSPPError=-2147217396#BKMK_DisplayString
    http://blogs.msdn.com/b/vcblog/archive/2013/06/28/using-visual-studio-2013-to-write-maintainable-native-visualizations-natvis.aspx
    Which shared us the detailed steps about how to custom views of native objects include the "DisplayString" like these:
    <Type Name="CPoint">
      <DisplayString>{{x={x} y={y}}}</DisplayString>
    </Type>
    Maybe it is related to the real format specifiers:
    https://msdn.microsoft.com/en-us/library/vstudio/75w45ekt.aspx
    Hope it could help.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Does key comparison work for character arrays?

    I am using the berkeley db(C) to store a 2-column table with key as a character array(not strings). Even though I can see that a record is present when i display all records, I cant get that record using the get function with the correct key. Is there a problem with key comparison? How does berkeley db check two keys for equality? Is there a way around this?
    thanks in advance.

    Hi,
    Your code posting was messed up due to the indexed addressing (the i in square brackets) which is in fact the italic start tag. You can put some spaces inside the square brackets, and make sure to enclose your source code between pre tags ([ pre ] <code goes here> [ / pre ], remove the spaces).
    So, I assume you are trying to store a line of the bi-dimensional char array.
         key.data = a + i;          
         key.size = sizeof(a[ i ]);
    // char *aa = "0a0s0d0f0g0h0j0k0l0q0w0e0r0t0y0f";(I've changed the name of this pointer to distinguish it from the array)
    aa points to a sequence of chars (a string in fact) that should be the same as the ones in the line of the bi-dimensional char array, line that was stored as key in the database, right?
    key.data = aa;
    key.size = sizeof(aa);Now, here is the problem. aa is a pointer to char, thus sizeof(aa) is 2B or 4B (depending on the pointer type, near or far) on a 32-bit machine. So, you're performing the search looking only for the match of the first 2 or 4 chars. Change that line to key.size = strlen(aa); or key.size = sizeof(*(a + i)); (the same as key.size = sizeof(a[ i ]);, a being the char array).
    Regards,
    Andrei

  • Validation Through Character Array Search - Visual Basic

    Hi,
    I am trying to use a character array search to validate the order of two elements, an "@" symbol and a ".". Essentially, it is a simple email address validation. The issue I am having is trying to find the best solution to check whether
    there is the "@" symbol, ensure there are characters after the "@", make sure there is a ".", and again make sure there are characters after the period. Anything that would lead me in the right direct would be appreciated.

    Such checks can be performed using Regular Expressions:
    Dim text = "[email protected]"
    Dim result As Boolean = Regex.IsMatch(text, ".+@.+[.].+")
    However there are more elaborated expressions or methods:
    https://msdn.microsoft.com/en-us/library/01escwtf(v=vs.110).aspx
    https://social.msdn.microsoft.com/Forums/en-US/7dfd7bdf-d268-4679-ad80-6db04f763e94

  • Sending an array of images via web service

    Hi!
    Is it possible to send an array of images using DataHandler[]?
    Thank you!
    Good Day!
    grazieee

    Hi Michael,
    Can I have an example of the JAX-RPC handler method?
    Thank you!!
    Good Day!
    grazieee..
    ================================================================
    "Michael Wooten" <[email protected]> wrote:
    >
    You can return a DataHandler[], but you can't currently pass one to a
    WLS (or WLW)
    web service opertion :-)
    For now, you should consider using a JAX-RPC Handler to achieve the same
    effect.
    Regards,
    Mike Wooten
    "grazieee" <[email protected]> wrote:
    Hi!
    Is it possible to send an array of images using DataHandler[]?
    Thank you!
    Good Day!
    grazieee

Maybe you are looking for

  • Inserting pdf files in word for mac

    For the life of me I can't figure out how to insert pdf files in my word for mac document. I can insert the first page of the file by inserting it as an object but can't figure out how to insert the entire document. Any suggestions would be much appr

  • Web Gallery - thumbnails link to the wrong photos

    anyone else got this issue? Ive uploaded various galleries, and it seems .mac is a bit confused. See, I have many photos in iPhoto that are titled e.g. CIMG09878. That was never a problem. Now though on the net, in the web gallery, if I click on one

  • Sortingnot properly working on fiscal year months in dashboard

    Hi, We have to display the fiscal year months (Like: Apr to Mar)  in Line chart. We already design Query in BW and it is giving the output on fiscal year period (April to March). But in the dashboard it displays from Jan to Dec. We have not  done any

  • InvalidClassException in throwing EJBException from WebLogic 6.1 to WebLogic 7.0

    We are running two versions of WL and need to run the GUI part of App on 7.0 and the business part on 6.1. We get an exception on 6.1 but in handling the exception on 7.0 we get the following error: java.io.InvalidClassException: javax.ejb.EJBExcepti

  • Where can I find the folder: com.apple.mail.drag

    Which is the folder that files are saved into when I accidentally press "Save" button instead of "Save All". 1. It tells me that it is in a folder called Privet, but I'm unable to find it via finder. 2. is there a way to change this default folder? 3