Results 1 to 2 of 2

Thread: Deserialization from byte array

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2008
    Posts
    40

    Deserialization from byte array

    Afternoon all,

    Coming up against a brick wall with sending items over the network using sockets. I'm using Chilkat rather than the built in TCP Client / listener but thats not the issue. From point a I send through a string converted to base64 as below

    Code:
    Public Function fn_ArrayListToBytes(ByVal arrTmp As ArrayList) As Byte()
    
            Dim rawFoo As New MemoryStream
            Dim formatterIn As New BinaryFormatter
            formatterIn.Serialize(rawFoo, arrTmp)
            rawFoo.Seek(0, SeekOrigin.Begin)
            Dim fooBytes As Byte() = New Byte(rawFoo.Length) {}
            rawFoo.Read(fooBytes, 0, rawFoo.Length)
    
            Return fn_encrypt_byte(fooBytes)
    
        End Function
    So at point b I want to convert that back and the code I have is as follows:

    Code:
     
    Public Function fn_ArrayListFromBytes(ByVal bytTmp As Byte()) As ArrayList
    
            Dim objBinaryFormatter As New BinaryFormatter
            Dim newRawFoo As New MemoryStream(fn_decrypt_byte(bytTmp))
            Dim RebuiltArraylist As ArrayList = objBinaryFormatter.Deserialize(newRawFoo)
    
            Return RebuiltArraylist
    
        End Function

  2. #2

    Thread Starter
    Member
    Join Date
    Oct 2008
    Posts
    40

    Re: Deserialization from byte array



    Please see the associated error as I'm getting (attached).

    I've also got a windows explorer view that goes over the sockets but when that comes back, depending on folder totals it crashes out completely.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width