Board index » delphi » Send / Receive File (Indy TCP c/s)

Send / Receive File (Indy TCP c/s)

Hi,

I need a small example for sending / receiving a binary file using
IdTCPServer and IdTCPClient.
Thank You

--
&*&%##%^$^#))00
guru meditation error
---
Ioan Ghip

 

Re:Send / Receive File (Indy TCP c/s)


i...@pangea-comm.com (Ioan Ghip) wrote in <8rfol8$7to2
@bornews.borland.com>:

Quote
>Hi,

>I need a small example for sending / receiving a binary file using
>IdTCPServer and IdTCPClient.
>Thank You

Didn't I send you an example bakc in the old days of Winshoes? :). If so
just apply the same principals.

--
Hadi Hariri
http://delphi.urusoft.com

Re:Send / Receive File (Indy TCP c/s)


Hi Hadi,

I hope I'm wrong, I will check the home email archive... but I don't
remember using TWinshoeClient and TWinshoeListener....
I used with success some of your components:
POP3, SMTP both client/server, Message,
HTTPListener, FTP, IPWatch, MappedPort, Time, Ping,
but I don't remember using TWinshoeClient and TWinshoeListener....
just give me a hint for sending/receiving binary files using TidTCPClient
and Server and I'll figure out...I hope...:-)

---
&*&%##%^$^#))00
guru meditation error
---
Ioan Ghip

"Hadi Hariri - Team Indy" <h...@delphihome.com> wrote in message
news:8FC4B5CEChadidhcom@207.105.83.62...

Quote
> i...@pangea-comm.com (Ioan Ghip) wrote in <8rfol8$7to2
> @bornews.borland.com>:

> >Hi,

> >I need a small example for sending / receiving a binary file using
> >IdTCPServer and IdTCPClient.
> >Thank You

> Didn't I send you an example bakc in the old days of Winshoes? :). If so
> just apply the same principals.

> --
> Hadi Hariri
> http://delphi.urusoft.com

Re:Send / Receive File (Indy TCP c/s)


i...@pangea-comm.com (Ioan Ghip) wrote in <8rihoa$3dn3
@bornews.borland.com>:

Quote
>I used with success some of your components:

Thanks but they aren't actually mine :).

Quote
>POP3, SMTP both client/server, Message,

That must have been it then since your name is very familiar (and not
common either).

Quote
>just give me a hint for sending/receiving binary files using TidTCPClient
>and Server and I'll figure out...I hope...:-)

Ok basically this is the code (untested, uncompiled and on the run):

You setup a server and in the OnExecute you do something like this:

var
  FS:TFileStream;
begin
  FS := TFileStream.Create('c:\download', fmOpenShare);
  try
    AThread.Connection.WriteStream(FS);
  finally
    FS.Free;
end;

and in the client:

var
  FS: TFileStream;
begin
  FS := TFileStream.Create('c:\gotit', fmCreate);
  try
    IdTCPClient1.ReadStream(FS);
  finally
    Fs.Free;
  end;

end;

Of course, you would have to use WriteLn for example to send the name of
the file first, etc.. This assumes you are sending a file from the server
to the client.

Re:Send / Receive File (Indy TCP c/s)


Hi,

I want to up/down load files from or to a server or a client via web
do you know how to do that, & have you some info example, or url to
learn to do it?

thank you for your help.

Patrick

On 5 Oct 2000 20:38:54 GMT, in borland.public.delphi.internet.winsock

Quote
you wrote:
>i...@pangea-comm.com (Ioan Ghip) wrote in <8rihoa$3dn3
>@bornews.borland.com>:

>>I used with success some of your components:

>Thanks but they aren't actually mine :).

>>POP3, SMTP both client/server, Message,

>That must have been it then since your name is very familiar (and not
>common either).

>>just give me a hint for sending/receiving binary files using TidTCPClient
>>and Server and I'll figure out...I hope...:-)

>Ok basically this is the code (untested, uncompiled and on the run):

>You setup a server and in the OnExecute you do something like this:

>var
>  FS:TFileStream;
>begin
>  FS := TFileStream.Create('c:\download', fmOpenShare);
>  try
>    AThread.Connection.WriteStream(FS);
>  finally
>    FS.Free;
>end;

>and in the client:

>var
>  FS: TFileStream;
>begin
>  FS := TFileStream.Create('c:\gotit', fmCreate);
>  try
>    IdTCPClient1.ReadStream(FS);
>  finally
>    Fs.Free;
>  end;

>end;

Re:Send / Receive File (Indy TCP c/s)


Quote
> Thanks but they aren't actually mine :).

I mean your team... great job!

Quote
> >POP3, SMTP both client/server, Message,

> That must have been it then since your name is very familiar (and not
> common either).

Great job too:-)
About the name... your is verrrry common, I think if you look in "white
pages" you can found 200 peoples with your name:-))

Lets talk about business:-)

Thank you for the sample code is work fine after small modifications.
I have one (?)  question.
What I have to do is:
On the server side:

1) Listen for incoming calls from clients
2) Get from client a login & password + some more info (text)
3) Get a file (binary)
4) Save the info and the binary file in a folder

The question is how many income calls in the same time the server can
handle?
What is happens if I have 2 or more clients connected in the same time?
It is possible to have 100 or more concurrent connections; can the server
handle this amount of connections?

Thank you again,

---
&*&%##%^$^#))00
guru meditation error
---
Ioan Ghip

Re:Send / Receive File (Indy TCP c/s)


Quote

>The question is how many income calls in the same time the server can
>handle?

Depends on your system, and other factors.

Quote
>What is happens if I have 2 or more clients connected in the same time?

Not a problem. As long as you don't share resources with two clients at the
same time. You would need to use some kind of critical section.

Quote
>It is possible to have 100 or more concurrent connections; can the server
>handle this amount of connections?

Shouldn't be a problem.

--
Hadi Hariri
http://delphi.urusoft.com

Re:Send / Receive File (Indy TCP c/s)


Hi again,

It is posible to use in the same application 2 or 3 IdTCPServer listening on
3 ports and set the OnExecute event to the same procedure?

Ioan Ghip

"Hadi Hariri - Team Indy" <h...@delphihome.com> wrote in message
news:8FC6BED22hadidhcom@207.105.83.62...

Quote

> >The question is how many income calls in the same time the server can
> >handle?

> Depends on your system, and other factors.

> >What is happens if I have 2 or more clients connected in the same time?

> Not a problem. As long as you don't share resources with two clients at
the
> same time. You would need to use some kind of critical section.

> >It is possible to have 100 or more concurrent connections; can the server
> >handle this amount of connections?

> Shouldn't be a problem.

> --
> Hadi Hariri
> http://delphi.urusoft.com

Re:Send / Receive File (Indy TCP c/s)


avr...@hotmail.com (Avraam) wrote in <39e692c2_2@dnews>:

Quote
>It is posible to use in the same application 2 or 3 IdTCPServer listening on
>3 ports and set the OnExecute event to the same procedure?

Yes, but there is not need. Just add multiple bindings to the same TCPServer
to have it listen on multiple ports.

--
Chad Z. Hower (Kudzu) - Church Hill, TN - Team Indy
      "Programming is an art form that fights back"
Forget the Y2K problem, Lets fix the W2K problem.
http://www.pbe.com/Kudzu/ - Free Delphi/CBuilder components and articles

Other Threads