Page 1 of 1

Sample ftpserv

Posted: Mon Nov 19, 2007 3:42 pm
by Surasak
I try to test sample file c:\fwh\samples\ftpserv.prg
but function TftpServer not found.
Please tell me how to solve this problem.
Thank..........


************ Sample Source Code ***************
// FiveWin Class TFtpServer demo
#include "FiveWin.ch"
static oWnd, oFTPServer
function Main()
local oBar
DEFINE WINDOW oWnd TITLE "FiveWin FTP server"
DEFINE BUTTONBAR oBar _3D OF oWnd
DEFINE BUTTON OF oBar ACTION BuildServer()
ACTIVATE WINDOW oWnd
return nil

function BuildServer()
oFTPServer := TFtpServer():New()
oFtpServer:cLogFile = "ftpserv.log"
oFtpServer:lDebug = .t.
oFTPServer:Activate()
return nil


******************* Complie Resulte **********************
ฺฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฟ
ณ FiveWin for Harbour 7.11 - Nov. 2007 Harbour development power ณ
ณ (c) FiveTech, 1993-2007 for Microsoft Windows 95/98/NT/2000/ME/XP/Vista ณ
ภฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤู
 ฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿฿
Compiling...
Harbour devel build 1.1-1 Intl.
Copyright (c) 1999-2007, http://www.harbour-project.org/
Compiling 'ftpserv.prg' and generating preprocessed output to 'ftpserv.ppo'...
Lines 3539, Functions/Procedures 3
Generating C source output to 'ftpserv.c'... Done.
Press any key to continue . . .
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
ftpserv.c:
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_HB_FUN_TFTPSERVER' referenced from C:\PROJECT\TEMP\
FTPSERV.OBJ

Posted: Mon Nov 19, 2007 7:05 pm
by Antonio Linares
The class source code is located at source\classes\tftpserv.prg

Posted: Tue Nov 20, 2007 7:11 am
by Surasak
Thank So Much...

Complie is Ok. after I add class to source code.
But when I ACTION BuildServer() have some error ( No exported variable: ) in line No. 25,26 and 28

Source Code Line 25 oFtpServer:cLogFile = "ftpserv.log"
Source Code Line 26 oFtpServer:lDebug = .t.

Source Code Line 28 oFTPServer:Activate()



Application
===========
Path and name: C:\ProjectH\Test\ftpserv.exe (32 bits)
Size: 1,102,336 bytes
Time from start: 0 hours 0 mins 2 secs
Error occurred at: 11/20/07, 14:04:22
Error description: Error BASE/1005 No exported variable: CLOGFILE
Args:
[ 1] = U
[ 2] = C ftpserv.log

Stack Calls
===========
Called from: => _CLOGFILE(0)
Called from: ftpserv.prg => BUILDSERVER(25)
Called from: ftpserv.prg => (b)MAIN(15)
Called from: => TBTNBMP:CLICK(0)
Called from: => TBTNBMP:LBUTTONUP(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: => TCONTROL:HANDLEEVENT(0)
Called from: => TBTNBMP:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: => TWINDOW:ACTIVATE(0)
Called from: ftpserv.prg => MAIN(17)

Posted: Tue Nov 20, 2007 7:36 am
by Antonio Linares
Whats the size of your tftpserv.prg file ?

Posted: Tue Nov 20, 2007 8:59 am
by Surasak
\fwh\source\classes\tftpserv.prg size 12,288 bytes 299 Lines 11/11/1999
complie with bcc55 and fhw

Posted: Tue Nov 20, 2007 9:42 am
by Antonio Linares
Please check if the Class TFTPServer has these DATAs:

DATA lDebug
DATA cLogFile

Posted: Tue Nov 20, 2007 9:49 am
by Surasak
Class Source Code Beginning with

// FiveWin InterNet FTP Server

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

CLASS TFtpServer

DATA oSocket // main listening socket object

DATA aSockets INIT {} // clients attending sockets objects

DATA cAddress
DATA cDefPath // default FTP directory

DATA lDebug
DATA cLogFile

METHOD New( nPort ) CONSTRUCTOR

METHOD Activate() INLINE ::oSocket:Listen()

METHOD End() INLINE ::oSocket:End()

METHOD OnAccept()
METHOD OnRead()

METHOD Sockets() INLINE MsgInfo( Len( ::oSocket:aSockets ) )

METHOD Dir( cMask )

ENDCLASS

Posted: Tue Nov 20, 2007 12:09 pm
by Antonio Linares
The error you get is:
Error description: Error BASE/1005 No exported variable: CLOGFILE

but you see that there is a DATA cLogFile

Posted: Tue Nov 20, 2007 12:11 pm
by Antonio Linares
Ok, I found the problem :-)

In Method New() please replace:

return nil

with

return Self

Anyhow, please keep in mind that this Class TFTPServer is a work in progress as we need full multithreading support in Harbour/xHarbour in order to get it properly working

Posted: Tue Nov 20, 2007 2:15 pm
by Surasak
It work now.

new() method in tftpsession class allso have to change return to selt too.

Thank you so much :) :) :) :) :) :) :)
S. Jintanawason

Posted: Tue Nov 20, 2007 6:30 pm
by Antonio Linares
> new() method in tftpsession class allso have to change return to selt too

Thanks! :-)