Solved

send wave file thru network

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi parse string to params 3 123
Delphi: ForceDirectory plain function 7 32
Delphi: sending SMS on android platform 1 21
How to Get Images From Server using App Tethering 11 29
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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 …

810 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