Solved

send wave file thru network

Posted on 2001-07-20
4
155 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

943 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now