Re: .NET CF Socket are behaving very strangely

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi Matt,

That's true. I asked the Network admin to check that out.

In the meantime, I analysed the FTP log and I notice that PASV
followed by STOR/RETR works for port 1034, 1035, 1036, fails for 1037.
works again for 1038....

This looks very strange?

I will get back here with results following the router/firewall
configurations.

Best regards,
Atmaram

On Aug 18, 5:34 am, Matt Evans <im.djma...@xxxxxxxxxxxxxx> wrote:
Have you restricted the range of ports that the ftp server will use in
passive mode? The problem may be that the router/firewall has a
limited range of ports forwarded to the ftp server that is different
to the range of ports the ftp server uses, therefore when it selects a
random one for the passive ftp connection it is sometime blocked by
the firewall.

Matt

On Aug 17, 7:39 pm, "@maram" <atmaram.mull...@xxxxxxxxx> wrote:

Matt,

Thanks for your response.

The FTP server is configured to accept 700 connections. I am using the
PASV (passive mode) and this is enabled on the server. The following
is the log for a successful and an unsuccessful upload. I get the
error "No connection could be made because the target machine actively
refused it" when I make the call Socket.connect(...).

Note the port I use to connect to the FTP server for upload is
calculated port = (value_returned_by_PASV[4] * 256) +
value_returned_by_PASV[5].

---------------------------------------------------------------------------­-------------------------------------------
CASE 1: successful upload
Aug 14 18:14:21 101054 Incoming connection request on interface
81.17.245.71
Aug 14 18:14:21 101054 Connection request accepted from 86.43.69.25
Aug 14 18:14:21 101054 USER TDSdemo
Aug 14 18:14:21 101054 331 User TDSdemo, password please
Aug 14 18:14:21 101054 PASS ***********
Aug 14 18:14:21 101054 230 Password Ok, User logged in
Aug 14 18:14:21 101054 PASV
Aug 14 18:14:21 101054 227 Entering Passive Mode (81,17,245,71,12,227)
Aug 14 18:14:22 101054 STOR /download/test.txt
Aug 14 18:14:22 101054 150 Opening data connection
Aug 14 18:14:23 101054 File transfer complete
Aug 14 18:14:23 101054 226 Transfer complete
Aug 14 18:14:23 101054 QUIT
Aug 14 18:14:23 101054 Connection terminated.
---------------------------------------------------------------------------­-------------------------------------------

---------------------------------------------------------------------------­-------------------------------------------
CASE 2: unsuccessful upload
Aug 14 18:17:38 101080 Incoming connection request on interface
81.17.245.71
Aug 14 18:17:38 101080 Connection request accepted from 86.43.69.25
Aug 14 18:17:38 101080 USER TDSdemo
Aug 14 18:17:38 101080 331 User TDSdemo, password please
Aug 14 18:17:38 101080 PASS ***********
Aug 14 18:17:38 101080 230 Password Ok, User logged in
Aug 14 18:17:38 101080 TYPE I
Aug 14 18:17:38 101080 200 Type Binary
Aug 14 18:17:38 101080 PASV
Aug 14 18:17:38 101080 227 Entering Passive Mode (81,17,245,71,12,246)
Aug 14 18:17:42 101080 QUIT
Aug 14 18:17:42 101080 Connection terminated.
---------------------------------------------------------------------------­-------------------------------------------

So far, I think this is a router-related problem. I'll read more about
this stuff and get back to you guys.

Thanks and Regards,
-A

On Aug 13, 11:56 pm, Matt Evans <im.djma...@xxxxxxxxxxxxxx> wrote:

When you hit this problem have you tried to connect to the ftp server
from some other computer? Are you hitting some sort of limit on the
server?

Are you making a new connection to the server for each file? And if
so, have you closed the connection to the ftp server properly? If you
haven't the connections may be waiting for a timeout and so you are
hitting a limit on the number of connections allowed to the ftp
server, before one times out and then your app can connect again with
a new connection.

Matt

On Aug 13, 8:48 pm, "@maram" <atmaram.mull...@xxxxxxxxx> wrote:

Hi all,

I have a .NET CF 2.0 (with SP2) app that needs to upload files
continuously to an FTP server. Now this seemed to work fine until I
did load tests on it, i.e, I tried to send files continuously without
stopping. The following gives the details. I am testing this via
ActiveSync and Emulator (VS2005, WM5.0).

In a thread, I am uploading files, one by one.
-If a file cannot be uploaded successfully, the thread sleeps for 5
secs and tries again.
-If a file is uploaded successfully, the next file is uploaded. There
is no sleep here.

The problem: after having uploaded like ~70 files, I am getting the
exception "No connection could be made because the target machine
actively refused it". Now the thread tries again, then sometimes it
succeeds.

How do I proceed to troubleshoot this? Any ideas?

The bottomline is I can connect to the server for like 5 mins (for the
consecutive non-stop transfer of 70 files. This means I can connect to
the server, IP address, username and password of FTP server are all
ok.

Thanking you for your time.

Best regards,
-A + puzzled- Hide quoted text -

- Show quoted text -

.



Relevant Pages

  • Re: IPSwitch, Inc. WS_FTP Server
    ... > bounce attack as well as PASV connection hijacking. ... > The FTP bounce vulnerability allows a remote attacker to cause the ... > anonymously along with any internal addresses that the FTP server has ... That means it's got to handle a PORT ...
    (Bugtraq)
  • Re: Microsoft FTP Server problem on W2K?
    ... It is a UNISYS ClearPath mainframe system that is trying to FTP using ... passive mode to a MS FTP server. ... Currently the mainframe FTPs in ACTIVE mode. ... Since the mainframe pushes files to our customers over a WAN connection, ...
    (microsoft.public.inetserver.iis.security)
  • Re: how do i close an app that has no forms?
    ... FTP connections through Internet Explorer send info ... If you don't have a firewall ... > a connection is instantiated with a server. ... > a request is sent to the FTP server, ...
    (microsoft.public.vb.general.discussion)
  • Re: .NET CF Socket are behaving very strangely
    ... Set the PASV range for the FTP server to 1027 - 3500. ... My data connection works for ports ...
    (microsoft.public.pocketpc.developer)
  • Re: help with allowing ftp access.
    ... The "connection refused" error occured because you had no ftp server running. ... Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org ...
    (comp.os.linux.setup)