Sending binary data to Nativeprocess (C++)?

Hello
I am developing an AIR application, which uses lots of C++ libraries to do number crunching (OCR, taking screenshots,...)
I need to send somehow BitmapData objects to the C++ app, and i need to do this a lot (like every 1-2 secs.)
Until now, i've tried 3 methods, all would not work for me:
1. Save the file to the disk in AIR, start the application, and send the file path as a parameter.
This method is bad, its terribly slow, because of the lots of disk I/O and compression/decompression of images.
2. Make a socket server in C++, and use sockets in Actionscript to send files.
This method is fast, but since i use sockets, the program depends on firewall settings. (i get a "do you allow xxx.exe trough the firewall?" warning too).
This means, that users with bad firewall settings wont be able to use my application, and it is critical for me, that not tech savvy users can use my app too.
3. Use NativeProcess.standardinput/standardoutput to send data.
This method is fast (although i heard, that its slower, than sockets..), but i could not figure out how to send a bytearray. 
My best try was to receive a Bytearray containing a BitmapData:
int bsize = width*height*4;
char* buff = new char[bsize];
std::cin.read(buff,bsize);
This did not work either, the received Bytearray was always truncated at approximately its half height.
Anyone has a good solution? I would love to use sockets, if i can avoid firewall issues somehow. Or a working example how to send a bytearray to C++ would be OK too.
Thanks.

the messageString = "00000011"Wild guess: this is supposed to represent the bit pattern of a byte you need to send.
Don't use Strings at all, use bytes. This byte would be 3.
Carrying on from the wild guess,messageString = "0000001001101111000001010001001100000011"would becomebyte[] messageBytes = new byte[] {2, 111, 5, 19, 3}

Similar Messages

  • How to send binary data in the message body

    How can we send binary data in the message body that is base64 encoded? below are the requirements
    Mime Header.
    Mime-version: 1.0
    Content-Type: application/octet_stream; name=test
    Content-Transfer-Encoding: Base64
    Submission must be named "test.sub" (lowercase)
    Submission must be base64 mime-encoded
    Submission must be sent in the body of the message (not as an attachment)
    Only one submission per mail message
    No other comments should be put in the body of the mail message (other than the submission)
    I highly appreciate your help. If you can provide few examples, that will be very helpfull.
    Thanks,
    Madan

    Use Message.setContent to set the content, or use Message.setDataHandler with
    a DataHandler constructed with a ByteArrayDataSource. If the content is not
    "naturally" encoded in base64, you can enforce it by setting the Content-Transfer-Encoding
    header to "base64". Any reasonable mail reader won't care what encoding you use, as
    long as the decoded data is correct.

  • Sending Binary data using ASCII

    Hello All,
    I'm trying to control serial-interface instrument using NI-VISA with a set of ASCII codes, but the instrument reads/sends binary data only. What should I do so that the ASCII codes I send are converted into binary commands for the instrument to read, and that the data I receive is converted back into ASCII?
    Thanks in advance
    M

    Hi M,
    first you should define the words "binary commands/data". Then you should know: ASCII is binary too...
    You may work with an U8 array. You can easily convert strings to U8 arrays and vice-versa!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Sending Binary Data using HTP package

    Has anyone been successful in using the HTP package and its PUTRAW procedure to send binary data to a browser?
    Example code shows basic idea:
    create or replace
    procedure test_raw as
    output VARCHAR2(20);
    begin
    OWA_UTIL.MIME_HEADER('application/x-gzip', TRUE);
    output := 'Hello World!';
    HTP.PUTRAW(UTL_RAW.CAST_TO_RAW(output));
    HTP.FLUSH;
    end test_raw;
    I receive an empty file when called from the browser.
    What gives?

    I found my answer. I should be using wpg_docload.download_file(BLOB) to "download" a the contents of a BLOB.

  • Sending binary data from JSP (1.1)

    Hi all:
    I am using Tomcat 3.2.1 and Apache under Linux Mandrake OS.
    I have a JSP (1.1) sending binary data (GIF, PDF, DOC ..) using response.getOutputStream().write(data)
    method.
    The problem is the precompiler automatically creates the JspWriter and puts some out.write("\r\n") lines
    before I use getOutputStream method. The JVM throws an IllegalStateException because I am using both
    methods (this is from Servlet 2.2 specification).
    Must I change my code to forwarding to a servlet that make this work or is there a simple solution to
    avoid this?
    Thanks in advance.
    J.
    null

    Hi Shreeharsha
    Please refer to below docs for sending data from JSP page to RFC. In which you need to use sap connectors for connecting to SAP backend system.
    http://help.sap.com/saphelp_nw04/helpdata/en/b6/55e3952a902447847066a0df27b0d6/content.htm
    Hope it helps
    Regards
    Arun

  • Sending binary data over RS232 without conversion to ascii

    I need to send binary data to a PIC without the data being converted to ascii. With the VISA vi's, when I want to send 11111111, it gets converted to a string "255", and is sent as "2","5","5" in ascii.
    How can I send it as one byte?

    r_keller wrote:
    @tbob: I probably shouldnt tell my customer that he's an idiot, and obviously 9 bit addressing/signalling modes seem to be not so uncommon in industry, so ur post does not really contribute to solve the problem.
    Well I wouldn't call my customer an idiot either.  I didn't know he was your customer.  Sorry.  Not every comment posted here is intended to directly solve a problem.  We are a fun loving group, and occasional ribbings take place here.  I still think that trying to use 9 bits over an 8-bit protocol is not a good way to go.  But if it is the only way, then so be it.
    r_keller wrote:
     Does the Mark or Space parity bit add another 10th bit to the command or can i only use either ODD parity/Mark/Space?
    According to the link you attached, the parity bit adds only one more bit.  If the number of bits is set to 8, then the parity is the 9th bit, and you can only use Mark or Space to force that 9th bit to either 1 or 0 respectively.  If you try to use odd or even parity, the protocol will determine the parity and change the bit accordingly, and it may not be the one you intended to send.  The start and stop bits are fixed by the protocol and cannot be used for extra data bits.
    Actually, until I read that article about using Mark and Space, I had no idea at all that sending 9 bits at a time was possible.
    - tbob
    Inventor of the WORM Global

  • Reg : Sending Binary data as output in GP

    Hello ,
    I developed one webdynpro Project it has interactive adobe form ,  in Guided procedures
    created CO for Webdynpro Componet(GP interface) for this form and created GP inerface also.
    But in this callable object the Requestor creates new pdf form.This PDF(means interactive form is taken as binary for pdfsource )  form has binary data.
    *How to send this binary data as output in GP. *
    Please help me out.
    Thanks
    Risha

    thanks

  • Sending binary data as attachment

    Is that possible to send binary ( which is actually fragment of a large file i.e. 100MB ) data as attachment to SOAP message ?
    The complete scenario is below.
    * I have to send a large file around 100MB, to server as a fragment as attachment of SOAP message.
    * It is received at the server and sent as such to another server ( I dont want the user to send data directly to this "another" server, call it as main server ).
    * main server will update the fragment into a stream which remains unclosed until last fragment received.
    * after receiving SOAP message ( which contains the fragment ), main server will repond 'OK' to sub server.
    * If the sub server receives OK, then it will send the next fragment until EOF.
    May be at main server I may need to check whether the file is properly received using some checksum logic.
    I hope I am making sense. I am thinking of using Axis2 ( I am totally newbie to web services). Could someone point me if I miss something ?

    thanks

  • Java proxy to send binary data

    Hi guys,
    I needed a small clarification.
    I'm using java proxy sender and file receiver in a scenario. I want to pick up binary files (i.e. the file could be of any format text,zip,pdf, image etc) using jakarta commons api to connect to ftp and then call the proxy to send this file data via proxy.
    I'm not clear on how this requirement can be achieved or it can be achieved or not.

    Hi Stefan,
    I'm referring to the comments given by Michal in the below blog.
    [How to send any data (even binary) through XI, without using the Integration Repository|How to send any data (even binary) through XI, without using the Integration Repository]

  • Using a servlet to send binary data

    There is a section of our intranet that need to hold documents that have to be available only for a certain group of users. Here's my approach (if you think of a better one, please tell me):
    1-all the files are in a directory upper than WWWRoot so that nobody can directly download them
    2-there is a servlet that first: authentificate the user with username-password; and then lists all available documents.
    3-When one of these docs is clicked, I want my servlet to open the file using filesystem File object and then copy the content of the selected file in the http response body. What object and method should I use to do so? I dont know if I should use FileReader or something else. Dont forget it will not only has to work with text files, but also with binary data files like swf, powerpointpresentation and the like. So I fear that objects such as FileRead will mess special characters up and corrupt data.
    What would you advice me? Use FileReader or another object? Or maybe a completly different approach for the problem? And if you want to give me some sample codes, it would be appreciated.
    Thx for your help

    There is something I dont understand.. its bizarre. Usually I dont understand why a script is not working, but now, I dont understand why a scritp is working..
    Here are the codes that copy from a file to the servlet's ouput:
    //basic response configurations
    response.setContentType( mimeType );
    ServletOutputStream out = response.getOutputStream();
    //copy a file f to the servlet's output stream
    File f = new File( path );
    FileInputStream fis= new FileInputStream(f);
    int available = fis.available();
    byte[] b = new byte[available];
    fis.read(b);
    out.write( b );
    out.flush();
    They work fine. What I dont understand is that I tried them with a file of about 5 megs, and they still worked! I expected them to fail because the variable available is of the type int and then it implies that the maximum file size permitted by the algorithm should be 65536 bytes/1024=64 ko... isn't it????

  • Best practice for putting binary data on the NMR

    Hi,
    We're creating a component that will consume messages off the NMR, encode them, and subsequently put them back on the NMR. What's the best practice for sending binary data over the NMR?
    1. setContent()?
    2. addAttachment()?
    3. setProperty()?
    If NormailzedMessage.setContent() is the desired approach, then how can you accomplish that?
    Thanks,
    Bruce

    setContent() is used only for XML messages. The recommended way to accommodate binary data is to use addAttachment().

  • Binary data with JMF

    I would like to send plain old binary data using RTP. How can I use the JMF to send binary data without binding it to a codec or media type?

    TouringBMW wrote:
    JMF transports data every 10 seconds, why not use a Webservice? JMF transports data every 10 seconds? That's actually news to me, can you present the source of this information?
    I thought JMF sent out UDP packets as fast as it could / needed to...
    Is this plausible?Not really, no.
    I am looking for a way to stream large content from a server to a webclient to present it. What is the best way? I am using JavaFX as a cliënt.Depends on what kind of content you're talking about. If it's video, that's a different answer than if it's audio, which is different from powerpoint presentations. And your subject calls for an "image server", which doesn't even make sense in terms of "streaming". What does it mean to stream an image?
    Tell us what exactly you're wanting to do, and I'm sure we can come up with some recommendations on how best to do it... :-)

  • Streaming Binary Data

    Hi,
    I would like to send plain old binary data using RTP. How can I use the JMF to send binary data without binding it to a codec or media type?
    Thanks,

    sam8680 wrote:
    I would like to send plain old binary data using RTP. How can I use the JMF to send binary data without binding it to a codec or media type?Is there a particular reason you don't want to use a normal UDP or IP socket for plain old binary data?

  • Convert Binary Data into Pdf & send it as attachment in a mail from R/3

    Hi,
    Scenario:
    The interactive form saved in WebDynpro Application is sent to R/3 in binary format. It has to be converted into pdf and sent it as an attachment in mail to the respective person in workflow.
    Kindly help on these issues :
    1. How to receive the binary data in R/3 sent by the WebDynpro Application ?
    To my knowledge we can receive the binary in XSTRING data type. Plz correct me if am wrong.
    2. How do i convert the received binary data into pdf ?
    Thanks,
    Bharath Kaushik Krishnan

    HI Bharath,
    I think You can reuse teh XString for binary data.there are certain function modules in R/3 for creating pdf/for sending it as pdf attatchment.please search in abap forums you will find more information
    With Regards
    Naidu

  • Sending attachments/binary data from flex to Restful APIs

    Hi,
    We have a requirement of sending the files (or binary data) from flex GUI to Restful services(backend APIs). We are using flex HTTPService component to invoke the rest apis. The Rest APIs are designed to accept the multipart/mixed data which can support the binary data as well.
    Can any one help us understand, how can we send the multipart/mixed OR multipart/form-data  from flex to backend using the HTTPService. Or is there a better way to send the mixed data from Flex GU to Restful APIs.
    Request you to please respond to this at the earliest as this is very urgent.
    Thanks and Regards,
    --Revanth

    Has anyone worked on this issue?? i wanted a quick response as we are in the middle of the development and this is a r
    equirement
    Thanks
    -Revanth

Maybe you are looking for

  • Screen burn-in/ghosting on MacBook Pro with Retina Display

    I have had my 15 inch MacBook Pro with retina display for a little over a year now I and I have started to notice that when I am on a mostly white webpage for a few minutes, and then switch to a darker page, there is an obvious screen burn-in/ghostin

  • Organizing music on iPod Classic

    Is there a way to organize music on an iPod classic?  More specifically, I want albums sorted by artist and then year so they will be in the order of when they were released.  I know how to do this in iTunes (just click the column header and choose t

  • Planned Delivery Date and Actual Delivery date.

    Hi, Is there a report in SAP which shows the delivery date of a PO line item and actual GR posting date from PO history in one report? I need to display the planned delivery date and actual delivery date in one report, preferably in columns next to e

  • HT201209 how to tell how much you have left on your apple gift card

    how much money do i have left on my apple gift card?

  • Unable to use the same email address for a new blackberry Id

    I was unable to enter my blackberry Id password and so after the last attempt,the date wiped.now I want to create a new ID with the same email I used before but the system is telling me that this email is associated with an existing ID.please what do