User Profile

Collapse

Profile Sidebar

Collapse
swts
swts
Last Activity: May 8 '08, 05:06 PM
Joined: Feb 25 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • swts
    started a topic reading an writing bytes into a file
    in .NET

    reading an writing bytes into a file

    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];...
    See more | Go to post
    Last edited by Frinavale; Apr 30 '08, 06:19 PM. Reason: added [code] tags

  • swts
    replied to reading an writing audio files
    in .NET
    hi,

    i apologise for double posting.cud anyone help me resolve this problem.??
    See more | Go to post

    Leave a comment:


  • swts
    replied to reading an writing audio files
    in .NET
    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...
    See more | Go to post

    Leave a comment:


  • swts
    started a topic reading an writing audio files
    in .NET

    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
    See more | Go to post

  • swts
    started a topic multicasting using tcp
    in .NET

    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???
    See more | Go to post

  • swts
    replied to system.access.violation
    in .NET
    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???
    See more | Go to post
    Last edited by swts; Apr 18 '08, 05:37 PM. Reason: additional info

    Leave a comment:


  • swts
    replied to system.access.violation
    in .NET
    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);
    ...
    See more | Go to post
    Last edited by Frinavale; Apr 16 '08, 01:07 PM. Reason: added [code] tags

    Leave a comment:


  • swts
    replied to system.access.violation
    in .NET
    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 exception
    See more | Go to post

    Leave a comment:


  • swts
    replied to system.access.violation
    in .NET
    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 error
    See more | Go to post

    Leave a comment:


  • swts
    replied to system.access.violation
    in .NET
    the function PtrToStructure flags an error.
    See more | Go to post

    Leave a comment:


  • swts
    started a topic system.access.violation
    in .NET

    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);
    ...
    See more | Go to post
    Last edited by Frinavale; Apr 14 '08, 07:20 PM. Reason: added [code] tags

  • swts
    started a topic marshaling:SizeOf(object structure) error
    in .NET

    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);
    ...
    See more | Go to post

  • swts
    started a topic marshalling
    in .NET

    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)"
    ...
    See more | Go to post

  • swts
    started a topic byte array to struct
    in .NET

    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,...
    See more | Go to post

  • swts
    started a topic structure to byte array in c#
    in .NET

    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
    See more | Go to post

  • swts
    started a topic file handling in c#
    in .NET

    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#.
    See more | Go to post
No activity results to display
Show More
Working...