Transmission of Video File
-
Hi, I'm transmitting recorded video file over LAN using UDP but sometimes file transmit successfully and sometimes at receiving side(client) it doesn't receive properly whereas at server side I get transmitting message. Please See my code and give me suggestion to overcome this problem.
public void filercvold() { outStream = File.OpenWrite(filepath); bufOutStream = new BufferedStream(outStream); i=0; while (i<=fsize)//fsize is filesize { try { idsock.ReceiveFrom(rcvfilebuf, ref idep); bufOutStream.Write(rcvfilebuf, 0, rcvfilebuf.Length); i++; } catch (SocketException ttt) { MessageBox.Show(ttt.Message); } } bufOutStream.Flush(); bufOutStream.Close(); outStream.Close(); MessageBox.Show("File is completly received!!"); }
//outStream is FileStream Object //bufOutStream is BufferedStream Object idsock is socket object // rcvfilebuf = new byte[16384]; 16KB packet Now whenever I got last msg "File is completly received" File fully saved and run properly. but when I dont get this msg as at server side I got transmitting msg but at same time at client side above notification doesn't show as client become stuck or remain in this statement " ReceiveFrom(rcvfilebuf, ref idep);" Now tell me how to check this or rcv full video every time as it doesnt happen everytime.By same code I got this msg and run video file at client but by same code above problem I face so what is main reason or where I'm doing wrong. Thanx in advance. Regards,Shanzay
-
Hi, I'm transmitting recorded video file over LAN using UDP but sometimes file transmit successfully and sometimes at receiving side(client) it doesn't receive properly whereas at server side I get transmitting message. Please See my code and give me suggestion to overcome this problem.
public void filercvold() { outStream = File.OpenWrite(filepath); bufOutStream = new BufferedStream(outStream); i=0; while (i<=fsize)//fsize is filesize { try { idsock.ReceiveFrom(rcvfilebuf, ref idep); bufOutStream.Write(rcvfilebuf, 0, rcvfilebuf.Length); i++; } catch (SocketException ttt) { MessageBox.Show(ttt.Message); } } bufOutStream.Flush(); bufOutStream.Close(); outStream.Close(); MessageBox.Show("File is completly received!!"); }
//outStream is FileStream Object //bufOutStream is BufferedStream Object idsock is socket object // rcvfilebuf = new byte[16384]; 16KB packet Now whenever I got last msg "File is completly received" File fully saved and run properly. but when I dont get this msg as at server side I got transmitting msg but at same time at client side above notification doesn't show as client become stuck or remain in this statement " ReceiveFrom(rcvfilebuf, ref idep);" Now tell me how to check this or rcv full video every time as it doesnt happen everytime.By same code I got this msg and run video file at client but by same code above problem I face so what is main reason or where I'm doing wrong. Thanx in advance. Regards,Shanzay
Without seeing all of the related code, we probably can't help you.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001