.NET Framework Bookmark and Share   
 index > .NET Remoting and Runtime Serialization > how to transfer a large .wmv file in remoting
 

how to transfer a large .wmv file in remoting

hi

i wrote an remote application,i want to transfer a .wmv file from one machine to other,i want to split the .wmv (into "x" kbs)and send it to the remote machine and use it there.if i try to send the complete file means it will take lot of memory that seems very bad.so i want to split it and send it.but the file doesnt gets played it raises an exception the format is not supported.

Kartheechidambaram
Hello,

Although I haven't tested this, I think you could achieve this by creating 3 methods server-side.
Methods: StartSending, Send and StopSending

Client side:
First call the StartSending method to notify the server you're about to start sending bytes.
You could also provide a GUID and a file name, so you can use this procedure from 2 clients or more at the same time.
The servershouldcreate a BinaryWriter

Then (back client side) you would use a BinaryReader to read chunks of bytes (e.g. you could read them per 1024 bytes)
Put these bytes in a byte array
After every 1024 bytes send them using the Send method (pass the byte array as argument).

When the end of the file has been reached, use Send one last time to send the remaining bytes
Close the BinaryReader

Finally, call the StopSending to notify the server to finish its file. (Server can then close its BinaryWriter)

The method singatures could look something like this:

StartSending(Guid guid, string filename);
Send(Guid guid, byte[] bytes);
StopSending(Guid guid);

As I already mentioned, I haven't tested this, but I think it should work.

Kind regards,
Stefan Adriaenssen
Stefan_A

You can use google to search for other answers

Custom Search

More Threads

• How to calculate the time taken for Soap serialization and deserialization
• C# TCP Remoting Security Exception
• System.AccessViolationException in cross-appdomain communication
• Remoting in Citrix (Terminal Services) Environment
• Object must implement IConvertible
• Getting problem extracting bytes of an Object using marshalling....
• .NET Remoting losses connection
• .Net Remoting in a soft realtime system
• "Requested Service not Found" when hosting Single-call object in IIS Web Garden
• Which is the best remoting concept