Skip to content
Advertisement

File corrupted while sending through socket

I am just trying to send some files from a socket and i am able to send those files without any interruption: also whether the size file is small or large that does not matter it sends like a charm.

But the problem in my case that is arising is the file that i sent is being corrupted, i.e. it is not playing like audio or video. I have already gone through this but it did not helped.

The code that I am using is below.

Server Side:

JavaScript

And the Client Side :

JavaScript

Thanks in advance.

Advertisement

Answer

So after the conversations in comments and as @MarquisofLorne told to delete the line that i have written in my server side code. i.e either delete this line from server side code:

JavaScript

or write this below line code in client side code:

JavaScript

It solves the problem.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement