Solved

send wave file thru network

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

19 Experts available now in Live!

Get 1:1 Help Now