Click to See Complete Forum and Search --> : wave file in network!


chittivamshi
May 26th, 2004, 02:26 PM
hi all,
i am new to socket progamming,plz help me

i want to send wav file from server to client along with udp packet.

how can i read from the local directory,store in buffer at serverside


and how to read at client side?

what about the buffersize.
if possible,i need an explanation with regarding c or c++ language.

tnx in advance
chittivamshi

wxuf
May 27th, 2004, 04:05 AM
if the file size is small, it is a good way by sending udp.
but at first, you must know the priciple of socket and several apis from msdn.
normally speaking, the procedure of udp mode is as follow :

// Server :
socket s = socket() // create socket object
bind() // bind to ip & port.
accept() // wait the client to connect..
... // data exchange by call sendto or recvfrom()
close () ;// close at last

// client :
socket s = socket() ; // crate socket object
bind() ; // bind to the 255.255.255.255, port.
setsockopt() ; // enable the broad cast property.
sendto() ; recvfrom() ; // data exchange..
close() ; // close at last


wish this help you !

wxuf

chittivamshi
May 27th, 2004, 11:59 AM
i have tried sending .txt file but what about wave file sometimes which is in large size...
i want to send through udp packet...
thanx in advance..

kuphryn
May 27th, 2004, 12:03 PM
I recommend winsock and C++.

What are the reasons for UDP? UDP is a connectionless or message-based protocal. It is fast, but unreliable. Your application is designed to transfer data. I highly recommend TCP.

Kuphryn

chittivamshi
May 27th, 2004, 12:12 PM
i can send text files,but i couldnt send wave file

could u tell me how do u send wave file through tcp,
so that i can try from udp .

tanx ..
bye

kuphryn
May 27th, 2004, 12:25 PM
I highly recommend this book on winsock.

Network Programming for Microsoft Windows, Second Edition by Anthony Jones, Jim Ohmund

Kuphryn

wxuf
May 27th, 2004, 10:20 PM
Originally posted by chittivamshi
i can send text files,but i couldnt send wave file

could u tell me how do u send wave file through tcp,
so that i can try from udp .

tanx ..
bye

The UDP mode is used to send trivial files, and is unreliable, and you can benifit with a high speed. but if you want to send large size file, the send may fail for some reason for it is unreliable.

You can search in www.codeproject.com (http://www.codeproject.com) for some examples.

wxuf

Mathew Joy
May 28th, 2004, 12:35 AM
You have to use TCP for to send files across a network, as Kuphryn said. You can find lots of ex. on the net and on msdn. One such tutorial site is this (http://tangentsoft.net/wskfaq/)