Solved

send wave file thru network

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

679 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