home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
dsptchb1.zip
/
readme.b1
< prev
next >
Wrap
Text File
|
1997-06-04
|
7KB
|
167 lines
Dispatch started as an exercise in socket programming with Object REXX.
There is virtually no socket documentation comprehensible to a
non-programmer -- especially someone who cannot even read C. So I used a
freeware REXX pop client I found on Hobbes as a model. It did not work --
OREXX is more intolerant of extra 'END' statements than TREXX. But at
least I understood the general structure. There is little of that program
left in mine now.
As for protocols, I found that RFC's are easier to understand that I had
expected. So I wrote a bunch of little utilities: One to receive mail via
POP -- into a unique folder for each message with all attachments detached.
One to send mail via SMTP with files appended. One to post news. One to
download an entire newsgroup. Etc.
The other day, I decided to combine three of these into one. The result is
Dispatch.
Dispatch is a compiled OREXX program. It will only run under Warp 4.0 or
on a system with Object REXX installed and active. It uses REXXLIB
utilities and two shareware packages for mime and uuencoding. I will
eventually write both into my program. (I have the Base64 model I need, but does anyone have a REXX UUencoding model?) It also uses the excellent
SofTouch TCPIP functions.
WARNING
All three of these functions have been somewhat tested as free standing
modules. FTP, however, was an afterthought and has not been tested since
it was added.
There is only primitive error detection and handling. This program crashes
easily and cryptically. But since it is a simple command line utility, it
usually does no harm -- and tells you that it has died.
BUT -- I will not be responsible for any damage of any kind that results
directly or indirectly from your use of this program. You are warned that
I am a novice programmer and that this is an experiment.
FUTURE PLANS
Add fax dispatch support. (I already posted a utility to do this, FxShell.
I will integrate it.)
Add optional, simple GUI for the functions.
THE INTELLIGENT QUEUE
I am rather proud of this feature -- although I have no idea if it actually
adds to performance. At least I got it to work.
The original model I had to work with used LINEIN and LINEOUT methods. The
pop client went like this:
Grab a handful of data from the socket Parse out the first line (by looking
for a CRLF) Save it using LINEOUT. Parse out the second line Save it Etc.
Etc. Retain the last bit of data in the buffer if it is a partial line
Grab another handful of data from the socket.
The program forgot to strip off any dot ('.') which begins a line. This
would add more overhead.
It seemed to me that, even at disk access speeds, this method must add
overhead. So I tried to create an Object REXX Queue object with built in
logic.
My intelligent Queue is a subclass of the standard queue object. My pop
client, for example, does the following in place of what I described above:
Gets a bunch of data off the socket. Checks to see if it has the EOF
marker at the end. Queues it on the intelligent queue Gets another bunch
of data off the socket Etc.
Meanwhile, the queue process has been started as a concurrent process. It
pulls data off itself, looks for dots that need stripping (without parsing
the data into lines) and saves the data using CHAROUT.
The program you are about to use uses the same idea. The intelligent queue
reads in data in 10,000 character chunks. It pads any beginning of line
dots with dots. It queues the data on itself and goes back to the file for
more. Meanwhile, the main process which created the queue starts pulling
data off the queue and sending it out.
It is fast. With text files I have peaked at 115200 -- my port speed.
The most recent version of this program uses similar queues for moving
temporary data around. For example, I use mpack to make base64 files, but
strip off the headers and boundaries. To do this, I used to make a
temporary file and then copy it line by line onto the target file,
stripping out unwanted data. Now, I let an intelligent queue do the
processing and use CHARIN and CHAROUT. It is certainly faster than it was,
but I have no idea if the queue adds anything at all.
DOSFILE
There is one other aspect to this program I should mention. I use a
version of a class I am working on called DOSFile. It is an enhanced
subclass of the Stream class. Instances of the DOSFile class have all the
methods of the stream class plus: they can copy or move or delete or
create themselves, parse their paths, etc. When it moves itself (or,
optionally, when it copies itself) it allows one to move its focus to the
new physical file. Let me explain:
MyFile = .DOSFile~new('c:\example1.txt')
Yields a REXX instance of the .DOSFile class. It is manipulated by
reference to the MyFile variable. You get data out, for example, by using:
line = MyFile~linein
(I guess if it were REALLY object oriented they would have used LINEOUT,
but that would have created too much confusion.)
Let's say I need to move the underlying disk file into a directory. I
might write:
MyFile~move('c:\temp\example2.txt','R','V')
MyFile now refers to c:\temp\example2.txt
So MyFile~delete, deletes the new file.
Or, let us say I want to copy data from example1.txt onto example2.txt and
start dealing with the target file instead of the source file.
MyFile~copy('example2.txt','A','V','COPY')
appends the data from MyFile onto example2.txt and then switches the focus
of MyFile to example2.txt.
The free standing version of DOSFile also includes methods for the file to
zip itself, email itself, fax itself, base64 encode itself, etc. In light
of what I have learned from writing Dispatch I will have to rewrite DOSFile
completely. It was intended to make programming easier. I am not
completely satisfied with it from having used it, but the idea works and I
will continue work on it.
LICENSE
This grants you a license to experiment with this program at your own risk
until it is withdrawn. The license will be deemed withdrawn upon release
of any shareware or commercial version of the product.
FEEDBACK
Feedback is solicited. But be gentle. I wrote my first OREXX program only
three months ago and my first real REXX program only a year ago. And it is
hard to teach old -- 50 yo -- dogs new tricks.
INSTALLATION
Almost forgot this part. Put Dispatch anywhere you want. Activate OREXX
-- See the Warp 4 README Copy the GRXTCPIP.DLL to a directory in your
LIBPATH. Install the REXXLIB DLL contained in the Demo package enclosed.
Install MPACK and UUENVIEW to directories in your PATH.
Chris Barr
cbarr@ibm.net
PS
I forgot the following --
FTP -- the default mode is text. For binary, prepend the name
of the file to send with an * just as a mime file is in mail:
-F*dsptcha1.zip