Receive binary, want to println as ascii

Someone please help me. I am writing a Multicast receive program. How can I code when it receives the binary and println it as ascii? Such as
while(true) {
DatagramPacket dp = new DatagramPacket(buff, buff.length);
ms.receive(dp), // ms = new MulticastSocket(port)
(Right here, how to do the Seconds ,data type is Float, 64 bits)
// I am okay with Alphanumeric
String s = new String(dp.getData());
System.out.println(s);
I am appreciated your reply.

Try to use the charset along with the String constructor. use the following constructor
public String(byte[] data, int offset, int length, String encoding)
throws UnsupportedEncodingException
U can use US-ASCII ir UTF-16.
try it
Sagar

Similar Messages

  • Just received ipad want to close open programs in dock I know you hold icon until it jiggles but what do you do then to close that out?

    just received ipad want to close out icons in dock Iknow that you hold it until it jiggles but what do you to close that icon?

    When the Red MINUS sign appears tap it... After you have Closed the Apps... Press the Home Button.
    TASK BAR  iOS: Understanding multitasking
    http://support.apple.com/kb/HT4211

  • Receiving binary IDOC via Queue and convert it to XML-IDOC

    Hello,
    we are focusing the following scenario:
    We receive an plain, binary IDOC in a MQSeries Queue. We want to pick it, transform it and place it into R/3 (of course using XI 3.0). Afterwards the other way around.
    I know the Howto for the ABAP mapping from XML-Idoc to plain IDOC. This may also work for our scenario. Do you agree?
    The other way around is more difficult. I assume that - since the IDOC adapter resides in the ABAP stack - we cannot re-use an existant adapter module in the JMS adapter. Right?
    I heared about JCO capabilities of "xmlizing" Idocs - but did not find hints within the javadoc. Anyway, would this really be the preferred way - writing an user exit for the adapter using JCO - to handle this? There must be a way to do it better, must it not?
    How did you guys face this problem - I think its a common one...
    Any starting points for a discussion are appreciated....
    Greets,
    helge

    Hi Helge,
    For the conversion of the incoming flat message, one could imagine a similar ABAP mapping as the one described for the XML->flat message conversion. The function module IDX_IDOC_TO_XML could be a good starting point for your search.
    To perform conversions in the Java stack (e.g. in an adapter module) might be a quite complex task since you first have to get the IDoc metadata. And there you cannot reuse existing function modules.
    Best regards
    Joachim

  • Receive only wanted call

    Hi all,
    I recently bought blackberry passport and wanted to know whetner there is any fuction that I could receive calls only from pre-listed numbers. Previously I used samsung galaxy note and there was block mode which allows me to block all the call except pre-listed numbers. I know that there is  a fuction which block all the call in blackberry 10 os. sometimes I don't want to receive any call but still need to be connected with some important people like mom or wife.... Please help me.
    Many thanks,
    JY
    Solved!
    Go to Solution.

    you can block all or none on the device but there are several call blocking apps in BlackBerry World that you can use
    Click here to Backup the data on your BlackBerry Device! It's important, and FREE!
    Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
    Click to search the Knowledge Base at BTSC and click to Read The Fabulous Manuals
    BESAdmin's, please make a signature with your BES environment info.
    SIM Free BlackBerry Unlocking FAQ
    Follow me on Twitter @knottyrope
    Want to thank me? Buy my KnottyRope App here
    BES 12 and BES 5.0.4 with Exchange 2010 and SQL 2012 Hyper V

  • Serial receive - ignore \r\n CR LF ascii codes

    Hello,
    I am trying to read an array of characters including carriage return and line feed into one array into labview.  I receive the command then wait x miliseconds until all data has been received and then read all data in the buffer using the serial read function.  An example sequence of series of characters is as follows: 
    printf("RTCC time date\r\n35:6c:53\r\n0d/02/cb\r\n")
    I need to receive this exact set of characters and store them into one array in labview.  It appears that labview automatically breaks from the read routine when it receives the Carriage return or line feed code.  Which, when writing to an array only gives the characters up to the line feed, then overwrites them upon exiting and returning the receive the next set of chars up to the next line feed.  Which, in this case would require to have 3 separate arrays in order to store all of the data.  Which ends up looking like this:
    array1 "RTCC time date\r\n"
    array2 "35:6c:53\r\n"
    array3 "0d/02/cb\r\n"
    It seems like there should be a setting to disable the read function response to the \r\n, but I cannot find any.  For that matter, Can someone please guide to documentation that details this type of functionality using the VISA functions?  I have searched the help and it gives a very very superficial explanation.  I have found the VISA manual, but it only details C code implementation. 
    Attached is a VI that flows as explained. 
    Thanks 
    Solved!
    Go to Solution.

    All right, apparently I am a retard.  Last try.
    Attachments:
    deubg Receive data.vi ‏25 KB

  • Send XML and receive binary data via SOAP

    Hi folks,
    following idea (Client-Server-Rendering-Architecture):
    1. Send XML as JavaScript variable via SOAP to the InDesign Server
    2. Attached the XML String to a new document or template
    3. Apply several XMLRules to the docuument
    4. Render to document as JPG|PDF whatever
    5. Transmit the JPG (means binary) via SOAP back to the client
    Following problems raised by implementing this
    1. Build a new XML-Object with new XML() works, but how to attach this object to the document, i've just found importXML() but from file, not string and xmlElements.add() for adding just a tag not a whole xml tree. The importXML() performance from a File object is not that fast ...
    2. How to render a document not to a file with exportFile() but into a variable, object etc.?
    3. How to send a binary object (from an object, a variable or File object if not possible as describe in Q#2) back to the client via SOAP (scriptResult)? Do I have to expand the WSDL (and|or C++ API), any examples?
    Thanks for your help, by the way, the describe scenario is what I expect of a rendering server not more not less ...
    Tino

    for one thing, don't use == to compare strings... You have that all over the place, like:
    if(currentElement=="region") {                                                                                                                                                                                                                                                   

  • Received email wants to run attachment automatically?

    When I turned on my computer, the following email wanted to run automatically:
    "This message is used to carry data between the BlackBerry handheld and an associated server. Please do not delete, move or respond to this message - it will be processed by the server.
    BEGINETP 9
    BQIAAAAAAAAA
    ENDETP 145900082"
    Before I run it I need to verify it is indeed from Blackberry. The sender is: [email protected]
    Can anyone tell me if this is valid or bad? I have had this phone for 9 days and it is my first cell phone.  Thank you.
    Solved!
    Go to Solution.

    Sounds like you have Desktop Manager configured on your pc incorrectly.  I believe it's configured with enterprise server have to change to internet server.
    John
    Stevie Ray! 1954-1990
    ** Don't forget to resolve your post with the accepted solution.

  • Need to create a function to receive binary files from Java WebDynpro

    Hey,
    I need to recieve files from java Webdynpro and save them as a file on the backend
    system. After that, the file will be loaded to the documentum.
    In a function module, I only can get the files as a String. Therefore (I think), I need the
    binary file as base64 encoded. Otherwise I can´t get it as a string.
    Now I need to decode it in the backend, but how? I know, there are HTTP-classes
    in newer system, but not in the 4.6C System, I have here.
    Any idea, how I can recieve the files in the function module and transfer it as binary
    file to the backend system?
    If I load a file from the gui with gui_upload, I get the binary file as an internal table
    and can transfer it to the backend filesystem now. Maybe I can get the binary file
    in this way in the function?
    Thank You for Your help!
    Arne

    http://jakarta.apache.org/commons/net/

  • How to convert binary string to ascii

    Hi,
    See i have a string like this,
    String str = "10011100110001011001110011000101";
    Now i want to find exact ascii value of the binary string.
    Thanks in advance.

    First want to convert these bits to corresponding
    characters and then have to find ascii of the same.... corresponding to what? I think converting these "bits" to the corresponding chars is the whole story. But what about the original format?
    Guessing mode on ... does this help?
    String input = "...";
    StringBuffer result = new StringBuffer();
    for (int i = 0;i < input.length();i += 8) {
      result.append((char) Integer.parseInt(input.substring(i, i + 8), 2));
    System.out.println(result);

  • Read Binary File, Help me! Thanks!

    I want to read a binary file and tried several times,
    but failed, who can give me an example?
    Thank you !

    Thank you very much! my codes are listed below
    i want to read a binary file and convert to ASCII.
    import java.io.*;
    public class FileInputDemo
    public static void main(String args[])
    if (args.length == 1)
    try
    FileInputStream fstream = new FileInputStream(args[0]);
    DataInputStream in = new DataInputStream(fstream);
    while (in.available() != 0)
    System.out.println(in.readLine());
    in.close();
    }catch (Exception e)
    {System.err.println("File input error");}
    else
    {System.out.println("Invalid parameters");}
    }

  • Receiver email encoding problem using mail package

    Hi to all.
    I'm facing a email problem. My company email server is workig fine with emails subject but customers email server is making some strange changes when i use special characters such as 'á' or spanish letter 'n with a tail on the top'.
    I set the field 'Content_Type' of the email to 'text/plain; charset=ISO-8859-1' but isn't working. If i remove those special chars, the subject is OK.
    I also tried to add content conversion in the receiver email adapter in module tab but with no possitive results.
    I'm using SAP PI 7.0 sp14.
    Any idea of what is happening?
    Kind regards,
    Inigo.

    If you want to use non-ascii characters in email subject, then you have to apply a special notation for this, like follows:
    =?utf-8?Q?Auftragsbest=C3=A4tigung?= 
    This is email standard. So I recommend not use non-ascii characters in email subject.
    Regards
    Stefan

  • IDoc to File - Russian Characters not in UTF-8 format - File Receiver

    Hello,
    My scenario is Idoc to File. My SAP sender system is a Unicode system and my RFC connection to XI is also set to a unicode connection. My idoc is sent to XI OK and whenever I look at the payload in SXMB_MONI, I see the Russian characters OK, but the problem is when the file gets created.
    My receiver system wants the file in UTF-8 format.  When the file gets created, the Russian characters are not in UTF-8 encoding format. For example, the Russian chars look like (but without the spaces inbetween): Ð # Ð µ Ñ # Ð ¶ Ð ° Ñ # Ð µ Ð » Ñ ...
    Instead, the chars should look like: Держатель
    My file type in my file receiver comm channel is binary and I am also using the AF_Modules/XMLAnonymizerBean with anonymizer.encoding of utf-8.
    Can someone please help me determine the problem?
    Thank you,
    Rhonda

    Hi Rhonda,
    Hope you have set the following for your file receiver adapter :
    1. Transfer Mode is set to Binary,
    2. File Type Text,
    3. Encoding ISO-8859-1( for Western European Latin ).
    Inorder to recognize russian Character, try as follows :
    Your sender idoc after coming into Pi has XML encoding declaration 'UTF-8'.
    Write a simple XSLT mapping to change the value of the attribute "encoding" to "ISO-8859-1" in the output XML of message mapping . Include this XSLT map as the second mapping step in your interface mapping.
    First step in your interface mapping will be your already existing message mapping.
    An example of the XSL code :
    <?xml version='1.0'?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method='xml' encoding='ISO-8859-1' />
    <xsl:template match="/">
    <xsl:copy-of select="*" />
    </xsl:template>
    </xsl:stylesheet>
    Iam not sure whether Russian language encoding has ISO-8859-2 (Eastern European Latin) or
    ISO-8859-1( for Western European Latin )...pls check out !
    or you can also do java mapping instead of above mentioned xslt mapping  if you are comfortable with java code !
    Cheers,
    Ram.

  • UDP Sender and Receiver.

    Hi! I want to know if it is possible to convert the file UDPSender.java into a method that can be called by clicking a button? I slightly modified the UDPReceiver.java for it to be listening indefinitely and UDPSender.java I found on the net. And I created a what is supposedly my main file called Button.java.
    What I want to do is that for this Button.java which only has a button when clicked is supposed to do a UDPSender. But I have no idea how to do it. Hope someone can answer this.
    ====================================================================================================================
    ====================================================================================================================
    The code below is for UDPReceiver.java
    ====================================================================================================================
    ====================================================================================================================
    * @(#)UDPReceiver.java
    * @author
    * @version 1.00 2008/10/19
    import java.net.*;
    import java.util.*;
    import java.io.*;
    public class UDPReceiver {
         * Creates a new instance of <code>UDPReceiver</code>.
        public UDPReceiver() {
         * @param args the command line arguments
        public static void main(String args[]){
            try{
                 //Bound to socket 7 for receive
                 DatagramSocket socket = new DatagramSocket(7);
                 System.out.println("Bound to local port " +socket.getLocalPort());
                 while(true){
                      //Create packet of 512 byte length
                      DatagramPacket packet = new DatagramPacket(new byte[512], 512);
                      socket.receive(packet);
                      System.out.println("Packet received at " +new Date());
                      //Display packet information
                      InetAddress remote_addr = packet.getAddress();
                      System.out.println("Sender: " +remote_addr.getHostAddress());
                      System.out.println("from Port: " +packet.getPort());
                      //Display packet contents, by reading from byte array
                      ByteArrayInputStream bin = new ByteArrayInputStream(packet.getData());
                      //Display only up to the length of the original UDP packet
                         for(int i=0; i<packet.getLength(); i++){
                           int data = bin.read();
                           if(data==-1)
                                break;
                           else
                                System.out.println((char)data);
            catch (IOException e) {
                   System.out.println ("Error - " + e);
    }====================================================================================================================
    ====================================================================================================================
    This code is for UDPSender.java
    ====================================================================================================================
    ====================================================================================================================
    * @(#)UDPSender.java
    * @author
    * @version 1.00 2008/10/19
    import java.net.*;
    import java.util.*;
    import java.io.*;
    public class UDPSender {
         * Creates a new instance of <code>UDPSender</code>.
        public UDPSender() {   
         * @param args the command line arguments
         public static void main(String args[]){
             //Set hostname and message
            String hostname = "localhost";
            String message = "Hello";
            try{
                 //Create a datagram socket and look for the first available port
                 DatagramSocket socket = new DatagramSocket();
                 System.out.println("Using local port: " +socket.getLocalPort());
                 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
                 PrintStream pOut = new PrintStream(bOut);
                 pOut.print(message);
                 //Convert printstream to byte array
                 byte[] bArray = bOut.toByteArray();
                 //Create a datagram packet containing a maximum buffer of 512 bytes
                 DatagramPacket packet = new DatagramPacket(bArray, bArray.length);
                 System.out.println("Looking for hostname " +hostname);
                 //Get the InetAddress object
                 InetAddress remote_addr = InetAddress.getByName(hostname);
                 //Check host IP
                 System.out.println("Hostname has IP address = " +remote_addr.getHostAddress());
                 //Configure DatagramPacket
                 packet.setAddress(remote_addr);
                 packet.setPort(7);
                 //Send packet
                 socket.send(packet);
                 System.out.println("Packet sent at " +new Date());
                 //Display packet information
                 System.out.println("Sent by: " +remote_addr.getHostAddress());
                 System.out.println("Send from: " +packet.getPort());      
             catch (UnknownHostException ue){
                   System.out.println("Unknown host "+hostname);
              catch (IOException e) {
                   System.out.println ("Error - " + e);
    }====================================================================================================================
    ====================================================================================================================
    This is supposedly my main class file:
    ====================================================================================================================
    ====================================================================================================================
    * @(#)Button.java
    * @author
    * @version 1.00 2008/10/16
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.applet.Applet.*;
    public class Button extends JApplet implements ActionListener{
         public static void main(String[] args){
         JFrame frame = new JFrame();
         frame.setVisible(true);
         JPanel panel = new JPanel();
         JButton button = new JButton("send text");
         panel.add(button);
         frame.add(panel);
         frame.pack();
         public void actionPerformed(ActionEvent evt) {
              //Button.EchoClient();
    }Edited by: Eastsheen on Oct 20, 2008 12:33 AM

    You could call UDPSender.main(new String[0])

  • Receiver file schema

    I f i use Adapter specific identifiers in receiver file adapter...
    as pet this
    http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm
    but if i want the file schema format as abc_xxxx.dat wher xxxx is idoc number..
    where should i write the code and how should i implement it...

    I have got a problem where everything is showing fine in MONI....but variable substition is where i am facing some problem...please help me....I am not able to get the receiver file in the path specified.....
    I am doing IDOC to fixed length file..
    orders message type.
    recordset
    Head
    field1
    field2
    field5
    Body
    field1
    field2
    field3
    field10
    Tail
    field1
    field2
    field5
    File
    Name (ADDED JUST BECAUSE RECEIVER FILE WANTED WITH THE I NUMBER AS THE FILE NAME)
    Receiver name schema: HL_XXX.dat where XXX is the idoc number...
    now my file receiver CC looks like this.
    TP : NFS
    MP:FCC
    AE: Integration server
    Target directory:
    path
    File name schema: HL_%var1%.dat
    File contrsution mode : create
    File type binary : Binary
    Variable substitution Parameters:
    var1 : payload:MT_HL_file,1,FILE,1,Name,1
    Content conversion parameters:
    Head.fieldFixedLengths :20,14,8,10,4
    Head.endSeparator: \n
    Body.fieldFixedLengths: 20,14,8,10,4,4,2,14,12,1
    Body.endSeparator: \n
    Tail.fieldFixedLengths: 20,14,8,10,4,4,2,13
    Tail.endSeparator: \n
    FILE.endSeparator: \n
    FILE.fieldFixedLengths: 0,0
    FILE.fixedLengthTooShortHandling: Cut
    any ideas please
    Edited by: Harsha reddy on Aug 27, 2008 4:15 AM

  • Binary file

    hi
    i write in labview to binary file the data is double i suppose the default mode is without any headers i have succed to read it back in labview
    the problem is that i cant read the file from other places
    in matlab i recieve garbage
    fid = fopen(filename,'bin')
    data = fread(fid,....)
    fclose(fid)

    The binary data that LabVIEW writes is going to be readable only by
    LabVIEW because there is no "standard" binary file format. Each
    application that can handle binary files has it's own method of
    creating the file format.
    If you want the data to be available to read in other applications, you
    should save it as an ASCII (text) file. Most applications can read an
    ASCII file is some standard format like comma separated values or tab
    delimited files.
    If writing speed is an issue, try first writting the files as binary, then convert them to ASCII when needed.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

Maybe you are looking for