🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
18 messages
18 total messages Started by David Ayre Fri, 14 Jul 2006 14:57
IdFTP problem
#2185
Author: David Ayre
Date: Fri, 14 Jul 2006 14:57
36 lines
1961 bytes
Hi,

I have written a little ftp programme which works fine on my
computer which has Win XP Pro. I have tried it on a friend's system
and it comes up with this error message:-
Socket Error # 10055  no buffer space available.
I tried it on another system that had several computers on a
network and it worked fine on one but gave the Socket error on
another. I have set it up for a passive connection.
This is the code for the connection:-

	TStringList *SL = new TStringList;
	IdFTP1->Passive = true;
	IdFTP1->Connect(true,10000);
	Application->HandleMessage();
	if(!IdFTP1->Connected())Application->MessageBoxA("Not Connected","ERROR",MB_ICONEXCLAMATION | MB_OK);

	ListBox1->Clear();
	IdFTP1->TransferType = ftASCII;
	IdFTP1->ChangeDir("/lscpit/time/downloads");
	IdFTP1->List(SL,"*.*",true);
	ListBox1->Items->Assign(SL);
	

	IdFTP1->Quit();
	delete(SL);

All it should do is fill a listbox with the filenames in a
folder on my website. As I said, works on some but not other
computers and hoped that someone could give a suggestion as to
where I should look to find the problem.

Cheers,

David
Re: IdFTP problem
#2186
Author: Remy Lebeau (TeamB)
Date: Fri, 14 Jul 2006 16:29
13 lines
1253 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:44b7b0d0$1@newsgroups.borland.com...

> I have written a little ftp programme which works fine on my
> computer which has Win XP Pro. I have tried it on a friend's
> system and it comes up with this error message:-
> Socket Error # 10055  no buffer space available.

Which version of Indy ar you using?  Which line is throwing the error?


Gambit
Re: IdFTP problem
#2189
Author: David Ayre
Date: Fri, 14 Jul 2006 19:20
22 lines
1474 bytes
Sorry Remy, I'm using Indy 9 in BDS2006. I think it is throwing the error in the Connect statement.

David


"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>news:44b7b0d0$1@newsgroups.borland.com...
>
>> I have written a little ftp programme which works fine on my
>> computer which has Win XP Pro. I have tried it on a friend's
>> system and it comes up with this error message:-
>> Socket Error # 10055  no buffer space available.
>
>Which version of Indy ar you using?  Which line is throwing the error?
>
>
>Gambit
>
>
Re: IdFTP problem
#2191
Author: Remy Lebeau (TeamB)
Date: Fri, 14 Jul 2006 19:37
15 lines
1350 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:44b7ee96@newsgroups.borland.com...

> I'm using Indy 9 in BDS2006.

Which build of Indy 9, though?

> I think it is throwing the error in the Connect statement.

It would help if you could determine that for sure.  Have you tried stepping
through the code yet?


Gambit
Re: IdFTP problem
#2193
Author: David Ayre
Date: Sat, 15 Jul 2006 07:59
37 lines
2171 bytes
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>news:44b7ee96@newsgroups.borland.com...
>
>> I'm using Indy 9 in BDS2006.
>
>Which build of Indy 9, though?

9.0.50

>> I think it is throwing the error in the Connect statement.
>
>It would help if you could determine that for sure.  Have you tried stepping
>through the code yet?

No, because it works OK on my machine and I'll have to install
Borland on the friend's machine to do that. I think it must be
a firewall problem which I'm getting him to look into.

I also got a codeguard report as follows:-
Error 00001. 0x300010 (Thread 0x0D08):
Resource leak: The memory block (0xD12794) was never freed

The memory block (0x00D12794) [size: 28 bytes] was allocated with SysGetMem
Call Tree:
   0x004669D6(=ftpTest.exe:0x01:0659D6) system.pas#2648
   0x00477E92(=ftpTest.exe:0x01:076E92) IdComponent.pas#185
   0x0049236D(=ftpTest.exe:0x01:09136D)
   0x00492543(=ftpTest.exe:0x01:091543)
I can't see anywhere in my code that would leave a memory
block unfreed. Could this have occurred inside the ftp code?

Cheers,

David
Re: IdFTP problem
#2194
Author: Paul at NCF
Date: Sat, 15 Jul 2006 08:29
6 lines
1168 bytes
Hi,

You don't have ZoneAlarm installed do you?  I had problems with socket 
development, and I ended up getting a separate h/w firewall from 3Com.

Paul
Re: IdFTP problem
#2195
Author: David Ayre
Date: Sat, 15 Jul 2006 08:52
24 lines
1695 bytes
Hi Paul,

I haven't, but I'll find out if they have on the testing computer.
All the different firewall options make it very difficult to
design a simple ftp routine that just checks my website for an
update and downloads it it required. It means that I can't just
let someone install an application and run it without doing a lot
of fiddling with the firewall settings.

Cheers,

David


"Paul at NCF" <not plmacca@clara.co.uk> wrote:
>Hi,
>
>You don't have ZoneAlarm installed do you?  I had problems with socket 
>development, and I ended up getting a separate h/w firewall from 3Com.
>
>Paul
>
>
Re: IdFTP problem
#2198
Author: Remy Lebeau (TeamB)
Date: Sun, 16 Jul 2006 17:46
25 lines
1779 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:44b8a05a$1@newsgroups.borland.com...

> 9.0.50

When did you last update it, though?

> I also got a codeguard report as follows:-
> Error 00001. 0x300010 (Thread 0x0D08):
> Resource leak: The memory block (0xD12794) was never freed
>
> The memory block (0x00D12794) [size: 28 bytes] was allocated with
SysGetMem
> Call Tree:
>    0x004669D6(=ftpTest.exe:0x01:0659D6) system.pas#2648
>    0x00477E92(=ftpTest.exe:0x01:076E92) IdComponent.pas#185
>    0x0049236D(=ftpTest.exe:0x01:09136D)
>    0x00492543(=ftpTest.exe:0x01:091543)

There is not enough details in that log to isolate the leak, since the last
two entries do not mention their filenames.


Gambit
Re: IdFTP problem
#2197
Author: Remy Lebeau (TeamB)
Date: Sun, 16 Jul 2006 17:49
13 lines
1493 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:44b8acc2$1@newsgroups.borland.com...

> All the different firewall options make it very difficult to
> design a simple ftp routine that just checks my website for
> an update and downloads it it required.

FTP is a very firewall-unfriendly protocol.  You should consider using HTTP
instead, which is very firewall-friendly.


Gambit
Re: IdFTP problem
#2200
Author: David Ayre
Date: Sun, 16 Jul 2006 19:52
27 lines
1677 bytes
Thanks Remy,

I'll have at look at that. Can I download files in the same way
as I do with ftp?

Cheers,

David


"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>news:44b8acc2$1@newsgroups.borland.com...
>
>> All the different firewall options make it very difficult to
>> design a simple ftp routine that just checks my website for
>> an update and downloads it it required.
>
>FTP is a very firewall-unfriendly protocol.  You should consider using HTTP
>instead, which is very firewall-friendly.
>
>
>Gambit
>
>
Re: IdFTP problem
#2199
Author: David Ayre
Date: Sun, 16 Jul 2006 19:55
37 lines
2112 bytes
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>news:44b8a05a$1@newsgroups.borland.com...
>
>> 9.0.50
>
>When did you last update it, though?


Not for the last few months!


>
>> I also got a codeguard report as follows:-
>> Error 00001. 0x300010 (Thread 0x0D08):
>> Resource leak: The memory block (0xD12794) was never freed
>>
>> The memory block (0x00D12794) [size: 28 bytes] was allocated with
>SysGetMem
>> Call Tree:
>>    0x004669D6(=ftpTest.exe:0x01:0659D6) system.pas#2648
>>    0x00477E92(=ftpTest.exe:0x01:076E92) IdComponent.pas#185
>>    0x0049236D(=ftpTest.exe:0x01:09136D)
>>    0x00492543(=ftpTest.exe:0x01:091543)
>
>There is not enough details in that log to isolate the leak, since the last
>two entries do not mention their filenames.

That's all it gave me. There was nothing in my bit of code that
could have caused a memory leak. There were only a few lines to
test the ftp on different machines.

Cheers,

David
Re: IdFTP problem
#2201
Author: Remy Lebeau (TeamB)
Date: Mon, 17 Jul 2006 03:37
29 lines
1845 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:44ba98f8$1@newsgroups.borland.com...

> I'll have at look at that. Can I download files in the
> same way as I do with ftp?

HTTP is a much more straight-forward protocol to work with than FTP.  There
are fewer calls involved, ie:

    TFileStream *fs = new TFileStream("c:\\my folder\\update.dat",
fmCreate);
    try
    {
        try
        {
            IfHTTP1->Get("http://www.mysite.com/update.dat", fs);
        }
        __finally {
            delete fs;
        }
    }
    catch(const Exception &)
    {
        DeleteFile("c:\\my folder\\update.dat");
    }


Gambit
Re: IdFTP problem
#2203
Author: David Ayre
Date: Mon, 17 Jul 2006 15:37
40 lines
2033 bytes
Thanks Remy,

Looks good, I'll give it a try.

David


"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>news:44ba98f8$1@newsgroups.borland.com...
>
>> I'll have at look at that. Can I download files in the
>> same way as I do with ftp?
>
>HTTP is a much more straight-forward protocol to work with than FTP.  There
>are fewer calls involved, ie:
>
>    TFileStream *fs = new TFileStream("c:\\my folder\\update.dat",
>fmCreate);
>    try
>    {
>        try
>        {
>            IfHTTP1->Get("http://www.mysite.com/update.dat", fs);
>        }
>        __finally {
>            delete fs;
>        }
>    }
>    catch(const Exception &)
>    {
>        DeleteFile("c:\\my folder\\update.dat");
>    }
>
>
>Gambit
>
>
Re: IdFTP problem
#2206
Author: David Ayre
Date: Tue, 18 Jul 2006 10:09
47 lines
2282 bytes
Hi Remy,

I tried http and it worked OK. However, I have got TIdHTTP. Is
that the same as IfHTTP that you showed in your example below?
Also, is it possible to run a progress bar with HTTP as I did
with FTP?

Cheers,

David



>"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>>
>>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>>news:44ba98f8$1@newsgroups.borland.com...
>>
>>> I'll have at look at that. Can I download files in the
>>> same way as I do with ftp?
>>
>>HTTP is a much more straight-forward protocol to work with than FTP.  There
>>are fewer calls involved, ie:
>>
>>    TFileStream *fs = new TFileStream("c:\\my folder\\update.dat",
>>fmCreate);
>>    try
>>    {
>>        try
>>        {
>>            IfHTTP1->Get("http://www.mysite.com/update.dat", fs);
>>        }
>>        __finally {
>>            delete fs;
>>        }
>>    }
>>    catch(const Exception &)
>>    {
>>        DeleteFile("c:\\my folder\\update.dat");
>>    }
>>
>>
>>Gambit
>>
>>
>
Re: IdFTP problem
#2207
Author: Remy Lebeau (TeamB)
Date: Tue, 18 Jul 2006 16:51
19 lines
1826 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:44bcb359$1@newsgroups.borland.com...

> I have got TIdHTTP. Is that the same as IfHTTP that
> you showed in your example below?

Yes.

> is it possible to run a progress bar with HTTP as I did with FTP?

Yes.  Use the OnWork events, just like you would with TIdFTP.  If anything,
TIdHTTP is more accurate in regards to progress tracking because most
servers provide the real data size during downloads, whereas FTP does not.
So under most cases, the AWorkCountMax parameter in the OnWorkBegin event
will contain a real size instead of 0.


Gambit
Re: IdFTP problem
#2208
Author: David Ayre
Date: Tue, 18 Jul 2006 17:41
36 lines
2256 bytes
Thanks Remy,

That works great.

Why is it that ftp requires so much info, such as username and
password and has difficulty getting through a firewall, while
http seems to be able to go straight in?

Cheers,

David


"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>news:44bcb359$1@newsgroups.borland.com...
>
>> I have got TIdHTTP. Is that the same as IfHTTP that
>> you showed in your example below?
>
>Yes.
>
>> is it possible to run a progress bar with HTTP as I did with FTP?
>
>Yes.  Use the OnWork events, just like you would with TIdFTP.  If anything,
>TIdHTTP is more accurate in regards to progress tracking because most
>servers provide the real data size during downloads, whereas FTP does not.
>So under most cases, the AWorkCountMax parameter in the OnWorkBegin event
>will contain a real size instead of 0.
>
>
>Gambit
>
>
Re: IdFTP problem
#2209
Author: Remy Lebeau (TeamB)
Date: Tue, 18 Jul 2006 20:40
40 lines
3081 bytes
"David Ayre" <davidcayre@ntlworld.com> wrote in message
news:44bd1d4a$1@newsgroups.borland.com...

> Why is it that ftp requires so much info, such as
> username and password

Because that is the way the protocol is designed.  HTTP also has
username/password support, but it is not used as much since HTTP is mostly
used for publically accessible files.

> and has difficulty getting through a firewall

FTP uses multiple socket connections.  Data is sent on a separate connection
than the one that is used for sending commands.  Every time a new transfer
is started, even for directory listings, a new socket connection has to be
established.

For active transfers, that requires extra configuration inside of routers,
and extra inbound ports to be opened in firewalls.  For passive transfers,
that requires extra outbound ports to be opened in firewalls.  Admins don't
like opening up ports unnecessarily.

You also need to keep in mind that FTP is one of the oldest Internet
protocols that is still commonly in use, long before firewalls and routers
became commonly used.  The protocol was never designed to handle those newer
scenerios very well.  There have been some standards proposals to add new
features to FTP, but they are just patching the underlying design flaw that
is FTP's weakness.

> while http seems to be able to go straight in?

HTTP does not suffer from any of the problems that FTP has.  HTTP does not
use multiple socket connections.  And it is commonly used over standardized
ports that routers know how to handle efficiently, and that are commonly
open on firewalls to allow web browsers to work on company networks without
needing extra configuration by admins.


Gambit
Re: (No subject)
#2210
Author: David Ayre
Date: Wed, 19 Jul 2006 08:29
50 lines
3354 bytes
Thanks Remy for that very full and descriptive answer. You
have been exremely helpful.
Thanks again,

David

"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"David Ayre" <davidcayre@ntlworld.com> wrote in message
>news:44bd1d4a$1@newsgroups.borland.com...
>
>> Why is it that ftp requires so much info, such as
>> username and password
>
>Because that is the way the protocol is designed.  HTTP also has
>username/password support, but it is not used as much since HTTP is mostly
>used for publically accessible files.
>
>> and has difficulty getting through a firewall
>
>FTP uses multiple socket connections.  Data is sent on a separate connection
>than the one that is used for sending commands.  Every time a new transfer
>is started, even for directory listings, a new socket connection has to be
>established.
>
>For active transfers, that requires extra configuration inside of routers,
>and extra inbound ports to be opened in firewalls.  For passive transfers,
>that requires extra outbound ports to be opened in firewalls.  Admins don't
>like opening up ports unnecessarily.
>
>You also need to keep in mind that FTP is one of the oldest Internet
>protocols that is still commonly in use, long before firewalls and routers
>became commonly used.  The protocol was never designed to handle those newer
>scenerios very well.  There have been some standards proposals to add new
>features to FTP, but they are just patching the underlying design flaw that
>is FTP's weakness.
>
>> while http seems to be able to go straight in?
>
>HTTP does not suffer from any of the problems that FTP has.  HTTP does not
>use multiple socket connections.  And it is commonly used over standardized
>ports that routers know how to handle efficiently, and that are commonly
>open on firewalls to allow web browsers to work on company networks without
>needing extra configuration by admins.
>
>
>Gambit
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads