Home All Groups Group Topic Archive Search About

Avoiding Implicid Conversion?

Author
16 Feb 2006 9:48 PM
gregory_may
I am using a threadpool to process UDP broadcast messages.  I cant figure
out how to type the threadpool call back.  Below is a snip of my code.  The
"process_UDP_Message" needs to pass a byte array ....  but the Call Back
only passes back a generic object.  Anyone know how I can force the type of
"receiveBuffer" when I make the call to process_UDP_Message?


    'Main processing loop:
    If Not ThreadPool.QueueUserWorkItem _
        (New WaitCallback(AddressOf process_UDP_Message_deligate),
ExactBufferSize) Then
        Debug.WriteLine("Could not queue to thread pool.")
    End If


    Private Sub process_UDP_Message_deligate(ByVal RecieveBuffer As Object)
        'We are "late binding" & converting the object back to a byte array.
Not sure
        'What the performance of this is?
        process_UDP_Message(RecieveBuffer)
    End Sub


    Private Sub process_UDP_Message(ByVal RecieveBuffer() As Byte)
    'Process Message

Author
16 Feb 2006 9:52 PM
Mattias Sjögren
>        process_UDP_Message(RecieveBuffer)

        process_UDP_Message(CType(RecieveBuffer, Byte()))


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
16 Feb 2006 10:19 PM
gregory_may
thanks!

Show quoteHide quote
"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:urPvyL0MGHA.2704@TK2MSFTNGP15.phx.gbl...
>>        process_UDP_Message(RecieveBuffer)
>
>        process_UDP_Message(CType(RecieveBuffer, Byte()))
>
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP]  mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.