hi, i have a structure wid a byte array member
[code=c]
public struct pack
{ public byte[] data;
/*...*/
}[/code]
and i have an array of packets
the following code works fine:
[code=cpp]
FileStream inStream = File.OpenRead(" some file name");
FileStream outStream = File.OpenWrite( "some filename");
int bytesRead;
byte[] buf = new byte[4096];...
User Profile
Collapse
-
reading an writing bytes into a file
-
hi,
i apologise for double posting.cud anyone help me resolve this problem.?? -
reading an writing audio files
hi,
i need to know if there is a method to read an audio file silimar to text files? in my proj i need to read an audio file, digitally sign it, send it across the sicket an write it back an play it.... i tried to read an write using the normal stream reader but a lot of data was lost. is there any built in class or method tat cud help me perform this operation??i tried to read an write...Leave a comment:
-
reading an writing audio files
hi,
i wud like to know if there is any way in which i cud read audio files an write them back... is it possible to read audio files like text files an wrte them back.i need to send audio fils across the socket an write them back ...cud anyone help me.
thanks in advance -
multicasting using tcp
is there any method to implement multicastin using tcp?? wud multicastin using tcp be considered as multiple unicastin ?? how cud i implement it??? -
ya tats right. wat else cud i change??any other method u suggest to recreate the packets at the receiver end?? wen i tried copying the byte array from the receive buffer to a new byte array an then passing this new array as an argument to dearshalli function it flagged "safearraytypem ismatch".does this indicate any changes tat cud be made???Leave a comment:
-
this is the marshalling code:
[code=cpp]
public static byte[] StructureToByte sArray(object obj)
{
int len = Marshal.SizeOf( obj);
byte[] arr = new byte[len];
IntPtr ptr = Marshal.AllocHG lobal(len);
Marshal.Structu reToPtr(obj, ptr, true);
Marshal.Copy(pt r, arr, 0, len);
Marshal.FreeHGl obal(ptr);
...Leave a comment:
-
the functions worked fine when i tested it in the same application. but it flagged the error when i put the demarshalin function in the receiver side.however, i receive the byte array perfectly fine from the sender side. the same byte array is printed on the sender an receiver side.on passing the received byte array to the the function i get the exceptionLeave a comment:
-
system.AccessVi olationexceptio n:Attempted to read or write protected memory.This is often an indication that other memory is corrupt.at System.runtime. interopservices .marshal .ptrtostructure .
this is the errorLeave a comment:
-
-
system.access.violation
hi,
i am using unmanaged code.while converting to managed code i use the function
[code=cpp]
public static object ByteArrayToStru cture(byte[] bytearray)
{
IntPtr ptr = IntPtr.Zero;
try
{
ptr = Marshal.AllocHG lobal(bytearray .Length);
Marshal.Copy(by tearray, 0, ptr, bytearray.Lengt h);
... -
marshaling:SizeOf(object structure) error
hi,
the following marshaling code gives me an errror of "type packet cannot be marshaled as an unmanaged structure; no meaningful size or offset can be managed".
public static byte[] StructureToByte sArray(object obj)
{
int len = Marshal.SizeOf( obj);
byte[] arr = new byte[len];
IntPtr ptr = Marshal.AllocHG lobal(len);
... -
marshalling
hi,
i have written a code for marshaling a structure to byte array to send it across the network, the code works fine in 2005 version of visual studio, but, i get the following error in 2003 version.. " Unhandled Exception:Syste m.ArgumentExcep tion: type packet cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed at System.Runtime. InteropServices .Marshal.SizeOf (object structure)"
... -
byte array to struct
this is in reference to one of the posts i found in the .NET forum
i need to send structure across thru the socket....
static byte [] StructureToByte Array(object obj)
>
> {
>
> int len = Marshal.SizeOf( obj);
>
> byte [] arr = new byte[len];
>
> IntPtr ptr = Marshal.AllocHG lobal(len);
>
> Marshal.Structu reToPtr(obj, ptr,... -
structure to byte array in c#
hi,
i need to know if there s a mechanism to convert structure into a byte array.
i have a structure that has 4 byte arrays. i need to transmit this across using socket connection,can i convert this into byte array prior to transmission??. each of these structures go into the payload of each packet.kindly help -
file handling in c#
hi,
i need books or tutorial links for file handling in c#.kindly help.i need to read char from a file.is there any mechanism for pointers in c#.
No activity results to display
Show More
Leave a comment: