B4A Library [B4X] FTP Server implemented with Socket and AsyncStreams

JackKirk

Well-Known Member
Licensed User
Longtime User
I have been using a copy of this code with minor modifications and it works beautifully.

I can't seem to find a way to find the IP address of a client as he tries to log in.

Is this possible?

Thanks in anticipation...
 

JackKirk

Well-Known Member
Licensed User
Longtime User
Thanks Erel.
 

T201016

Active Member
Licensed User
Longtime User
Hi, Erel
Great idea, I miss SSL in your project yet. Will you think about it?
 

T201016

Active Member
Licensed User
Longtime User
And that's good news, I think I'll have to do something myself, thanks for the message.
 

TomDuncan

Active Member
Licensed User
Longtime User
Hi all,
I have been testing the ftp server over the last few days with a new ip_camera from China.
In a local Ethernet environment all is well.
I then pointed the camera via ftp to my noip address. I have port forwarded the three ports.
Most of the time it works but I do get this error.

B4X:
CurrentPath: /cam_03/20180721/IMG001
client: PASV
client: STOR IMG_chn0_TIMER_MNG_20180721164328_001.jpg
Data connection terminated: /cam_03/20180721/IMG001/IMG_chn0_TIMER_MNG_20180721164328_001.jpg
client: SIZE IMG_chn0_TIMER_MNG_20180721164328_001.jpg
client: PASV
client: APPE IMG_chn0_TIMER_MNG_20180721164328_001.jpg
java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    at java.net.SocketInputStream.read(SocketInputStream.java:171)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at java.net.SocketInputStream.read(SocketInputStream.java:127)
    at anywheresoftware.b4a.randomaccessfile.AsyncStreams$AIN.run(AsyncStreams.java:199)
    at java.lang.Thread.run(Thread.java:748)
error: (SocketTimeoutException) java.net.SocketTimeoutException: Read timed out
Data connection terminated: null
terminated
Number of clients: 0
Number of clients: 1
client: USER xx
client: PASS xx
User logged in: xx
client: SYST
client: TYPE I
client: CWD cam_03
CurrentPath: /cam_03
client: CWD 20180721

this error does seem to be random.
thanks
Tom
 

ajk

Active Member
Licensed User
Longtime User
Constanty get in WinSPC:

Disconnected from server
Could not retrieve directory listing
Error listing directory '/'.

and in log:

client: USER test
client: PASS test
User logged in: test
client: SYST
client: FEAT
client: OPTS UTF8 ON
client: PWD
client: TYPE A
client: PASV
error: <B4IExceptionWrapper: Error Domain=caught_exception Code=0 "*** -streamError only defined for abstract class. Define -[B4IFastSocket streamError]!" UserInfo={NSLocalizedDescription=*** -streamError only defined for abstract class. Define -[B4IFastSocket streamError]!}>
terminated
DataConnection_Close
Number of clients: 0
Number of clients: 1
client: USER test
client: PASS test
User logged in: test
client: SYST
client: FEAT
client: OPTS UTF8 ON
client: PWD
client: TYPE A
client: PASV
error: <B4IExceptionWrapper: Error Domain=caught_exception Code=0 "*** -streamError only defined for abstract class. Define -[B4IFastSocket streamError]!" UserInfo={NSLocalizedDescription=*** -streamError only defined for abstract class. Define -[B4IFastSocket streamError]!}>
terminated
DataConnection_Close
Number of clients: 0
 

ajk

Active Member
Licensed User
Longtime User
Like in Basic
10 Erel is always right
20 GOTO 10

Why can't I use lower numbers for Port?
 

OliverA

Expert
Licensed User
Longtime User
Why can't I use lower numbers for Port?
Port numbers below 1024 require administrative rights on most system
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…