Solved

send wave file thru network

Posted on 2001-07-20
4
162 Views
Last Modified: 2010-04-06
Hi 4 all...

i'm delphi developer i want simple code,which allow me to send wave file from pc to pc (thru network)...
Please assist me to performe this action..
i wait u..
thanks for assist

taj99
0
Comment
Question by:taj99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Accepted Solution

by:
hobiecat16 earned 100 total points
ID: 6304534
Hello taj99,

I hope you have a basic knowledge of how networking works otherwise it'll be difficult to help you...
Anyway, i can try =)

An easy way would be to oper a server TCP socket on the "receiver". when this server receive a connection request, it accepts it.
First, you send the name of the file, its size, etc. (all infos you want)
Then send the file, by 4096 bytes burst. (4096 is an example but it is "stupid" to send a file byte per byte)
when the server receive a burst, it add it to a TFileStream you would have created when the socket was opened.
and when the size of the TFileStream reach the file size you have sent at start, simple close the socket and the filestream...

Now, let's speak about the "sender".

I think the send of a file is easier.
Open the socket, then send the "header" data (i repeat, file size, file name etc.)
Then send the packets of the file (i would create a TMemoryStream, the file would be read with a TFileStream, the i would copy 4096 bytes to the TMemoryStream, i'll send its content, then i copy again, etc.)

But if you don't want to deal with streams etc, try using a component already made: you can even use a well known protocol such as FTP (see the ICS componentns from F. Piette they are very good for this purpose; http://overbyte.alexid.fr/frame_index.html).
A sample for each components is provided, allowing you to test it and to understand it.

Or even the TNmStream components provided with Delphi ! (i have delphi 5)
you'll find examples of usage in Delphi's samples directory.

PS: To send the data, if you don't use what i called a "well known" protocol or the TNmStream component, you'll still need a component that deal with sockets (except if you like to play with APIs). You can use TWSocket, from ICS, or the componentns provided with Delphi 5, but be carefull they have a small memory leak if you don't install the Service Pack.

I hope that all this stuff will be helpfull.

Regards,
Bertrand
0
 
LVL 3

Expert Comment

by:neostudio
ID: 6306723
Listening...
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8711229
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept hobiecat16's comment as answer

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question