Skip to Content
author's profile photo Former Member
Former Member

Byte Array

Dear all,

Does anyone has experience using DART ActiveX (udp), in receive event it tells to use byte array, how to do this in PB 11.5.

The samples that their give is VB. In VB they just using "Udp1.Receive s ' receive data into string ". I write in PB "ole_udp.object.receive(s)" //s is string datatype but this script return me an empty string. I Look up to the help file and find that this function must use byte array.

I'm not familiar with 'byte array' and how to declared it.

Can anyone help.

TIA

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 12, 2013 at 10:38 PM

    There is the Byte and Blob datatypes that might work.

    I have an example of using socket functions directly from PB without using an ActiveX control. It might work better for you.

    http://www.topwizprogramming.com/freecode_winsock.html

    Roland

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 13, 2013 at 02:05 PM

    Hi Eko,

    Here's some sample code I have in a PB WCF web service that declares and uses a byte array along with a file and memory stream for a PDF file that gets sent back to a PB client as a blob.

    System.IO.FileStream filestream

    System.IO.MemoryStream memStream

    byte lb_byte_array[]

    // create a file stream based on the new pdf file

    fileStream = create FileStream(ls_result, System.IO.FileMode.Open!, System.IO.FileAccess.Read!, FileShare.Read!)

    // create a memory stream

    memStream = create MemoryStream

    // copy the filestream to the memory stream

    fileStream.CopyTo(memStream)

    // allocate space in the byte array for the memory stream

    lb_byte_array = create byte[System.Convert.ToInt32(memStream.Length)]

    // copy the memory stream to the byte array

    lb_byte_array = memStream.ToArray()

    return blob(lb_byte_array)

    hth,

    Mark

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.