Re: Convert byte stream to user defined type/class
- From: "Ignacio Machin \( .NET/ C# MVP \)" <ignacio.machin AT dot.state.fl.us>
- Date: Mon, 30 Jan 2006 09:51:07 -0500
Hi,
"Macca" <Macca@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:AF9FEFD1-5616-407F-BFCB-DF177BA96D02@xxxxxxxxxxxxxxxx
> Hi,
>
> My application receives data from multiple sources transferred over
> ethernet. This data is broken into packets of bytes before being
> transmitted
> over the network.
The package size is (in most cases) irrelevant. The network layer is the
responsible of doing this . your app just read X amount of data.
> My application has to take the data and arrange into a user defined
> type/class.
Serialization could help you here.
> My question is :- what is the best/most efficient way of converting the
> individual packets of bytes into an array of say doubles?
If you know the size of the array you can read that amount of data in a
byte[], then using BitConverter.ToDouble ( .... ) convert each chunk to a
double.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
.
- Prev by Date: .NET 2.0 System.Net.CredentialCache
- Next by Date: Re: Application Reference
- Previous by thread: Re: Convert byte stream to user defined type/class
- Next by thread: Re: Convert byte stream to user defined type/class
- Index(es):
Relevant Pages
|