Sample ftpserv

Post Reply
Surasak
Posts: 28
Joined: Fri Jul 20, 2007 1:30 pm

Sample ftpserv

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

The class source code is located at source\classes\tftpserv.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
Surasak
Posts: 28
Joined: Fri Jul 20, 2007 1:30 pm

Post 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)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Whats the size of your tftpserv.prg file ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Surasak
Posts: 28
Joined: Fri Jul 20, 2007 1:30 pm

Post by Surasak »

\fwh\source\classes\tftpserv.prg size 12,288 bytes 299 Lines 11/11/1999
complie with bcc55 and fhw
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Please check if the Class TFTPServer has these DATAs:

DATA lDebug
DATA cLogFile
regards, saludos

Antonio Linares
www.fivetechsoft.com
Surasak
Posts: 28
Joined: Fri Jul 20, 2007 1:30 pm

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Surasak
Posts: 28
Joined: Fri Jul 20, 2007 1:30 pm

Post by Surasak »

It work now.

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

Thank you so much :) :) :) :) :) :) :)
S. Jintanawason
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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

Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply