Path: news.daimi.aau.dk!news.net.uni-c.dk!howland.erols.net!newsfeed.nacamar.de!wuff.mayn.de!Informatik.Uni-Dortmund.DE!news From: Sascha Kimmel Newsgroups: comp.lang.beta Subject: Re: processmanager Date: Tue, 16 Jun 1998 08:09:40 +0200 Organization: tricos.software @ http://www.tricos.com Lines: 196 Message-ID: <35860C24.C33C6B76@tonno7.cs.uni-dortmund.de> References: <35839E03.29B289E8@nef.wh.uni-dortmund.de> NNTP-Posting-Host: calzone1.informatik.uni-dortmund.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (X11; I; SunOS 5.5.1 sun4m) To: Jens Scharnow Xref: news.daimi.aau.dk comp.lang.beta:11623 Jens Scharnow wrote: > > Hello! > > I inteded to start an ftp connection from a beta programm. As I don't > know any beta-library concerning ftp I thought I could use 'lftp'. So I > made a process '/usr/bin/lftp' with some arguments. When I start the > process, lftp starts without the arguments I gave in order to manage the > ftp-commands by itself, but in normal mode. My next try was to start > lftp from within a shellskript. The skript I created worked, but when I > tried to start it from my BETA-programm it didn't start. > Does anyone know how I can manage this? > > Thanks, > Jensen > -- > Jens Scharnow, Dortmund > jensen@nef.wh.uni-dortmund.de > > http://www.nef.wh.uni-dortmund.de/~jensen Hi! Why don`t you use the process-Library for developing programs which use TCP/IP. It`s really very simple - all you need to know is how to implement the different protocols, in you case the FTP protocol. Here you find a very simple (and really not very well implemented ;-) version of a program which can connect to any server. All you need to know is the name of the server, e.g. waldorf.informatik.uni-dortmund.de and the port. The port for FTP is 21, for SMTP 25, for SMTP 101 and so on... But to implement an FTP-Client you need to build up a binary mode data connection, see the process library for details about this. ORIGIN '~beta/basiclib/current/systemenv'; INCLUDE '~beta/process/v1.6/streamsocket'; -- program: Descriptor -- systemenv (# s: @StreamSocket (# timeoutValue:: (# do 2->value #) #); host: (# do 'Enter hostname: '->putText; getline->myhost[]; exit myhost[] #); port: (# do 'Enter port: '->putText; getInt->myport; exit myport #); myhost,serverreply,msg,tmp: ^text; myport: @integer; thizerror: @boolean; showIP: (# myhost: @thisHost; Hostname: ^text; IP,count,place: @integer; bin: [32] @integer; clear: [4] @integer; tmp: @integer; hoch: (# h,wert: @integer; enter h do 1->wert; (if h > 0 then (for j: h repeat 2*wert->wert for); if); exit wert #); do myhost -> (Hostname[],IP); 1->count; loop1: (# do (if count > 32 then leave loop1 if); (IP mod 2)->bin[count]; (IP div 2)->IP; count+1->count; restart loop1 #); 1->count; 0->tmp; 1->place; loop2: (# do (if count > 32 then leave loop2 if); (for i: 8 repeat (if (bin[count] = 1) then i-1->hoch->tmp; tmp+clear[place]->clear[place] if); count+1->count; for); place+1->place; restart loop2 #); (* exit hostname[] #); do 'Welcome '->putText; showIP->putText; ' to tricosServerApp V0.1 - Use it at your own risk.'->putLine; newLine; 'Initiating connection'->putLine; s.init; 'Connecting...'->putLine; (2,host,port) ->s.connect (# accessError:: (# do 'There was an access error.'->putLine; 1->value; true->thizerror; #); resourceError:: (# do 'There was a resource error.'->putLine; 1->value; true->thizerror; #); refusedError:: (# do 'Connection refused by the server.'->putLine; 1->value; true->thizerror; #); intrError:: (# do 'There was an intr error.'->putLine; 1->value; true->thizerror; #); getHostError:: (# do 'Host could not be found.'->putLine; 1->value; true->thizerror; #); #); (if not thizerror then 'Your message to the server: '->putText;getLine; con:(# do getLine->msg[]; (if ('logout'->msg.equalNCS) then leave con; else msg[]->s.putLine; msg[]->putLine; 'Remote server ('->putText; myhost[]->putText; ':'->putText; myport->putInt; ') replied: '->putLine; read:(if (not (s.eos)) then s.getLine->tmp[]; (if (tmp[]<>none) then tmp[]->putLine; restart read; else leave read; if); if); 'Your message to the server: '->putText; restart con; if); #); if); s.close; 'Goodbye'->putLine; #) If you have any more questions feel free to ask. -- Kind regards, Sascha Kimmel (Webmaster@tricos.software) ----------------------------------------------------- tricos.software * the developers WWW: http://www.tricos.com eMail: webmaster@tricos.com