Serial communication
Eric Veldhuyzen (eric@terra.telemediair.nl)
Tue, 23 Nov 1999 09:45:16 +0100
--pgp-sign-Multipart_Tue_Nov_23_09:45:02_1999-1
Content-Type: text/plain; charset=US-ASCII
Hi,
I know this isn't really the correct place to ask, but since a lot of
you guys have a lot of experience with serial communications I'd like
to ask my question here anyway.
I have written a library to send files from my system (linux) to
another, based on the uucp 'g' protocol (I stripped some functionality
like variable window size and variable blocksize to save me some
time). I wanted to use the same library for both socket communication
and serial line communication, so I use the filedescriptor for reading
and writing to the device (socket). Reading and write works the same
way: I first check with select() if the the device is ready, and if it
is I read/write one character. This also give me the possibility to
have a timeout on the device.
This all works just fine, but it seems to be quite slow. Especially on
reading characters, writing seems fine. If I have two linux machines
talking to eachother or my linux with a windows machine (I kep my
library portable so that it will work with a few #ifdefs also on
windows over PPP) every thing works wiothout problem, but there is
some delay which makes it quite slow.
A college has made a DOS version of this protocol in turbo pascal, and
his version is a lot faster when receiving, (has the same strange
delay when he is sending me data) but has the problem that it seems to
drop characters at receiving. I am not quite sure what happens. When I
am sending my characters he suddenly doesn't seem to receive any data
anymore and then times out.
Is there anyone here who can give me some clues about what to do to
make all this work correctly? Am I using the wrong method to read
characters from the device? Or is there some what to speed it up? Is
there anything else I do wrong here? Can it be caused by some
modemsettings perhaps?
PS The link with mgetty is that the program which uses this library in
ttymode is started with mggety and that I use mgetty also to setup
the PPP link if one comes in.
--
#!perl # Life ain't fair, but root passwords help.
# Eric Veldhuyzen eric@terra.telemediair.nl
$!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~ # Perl Monger
/.(.)...(.)(.)....(.)..(.)..(.)/;`$^$~$/$: $^$*$@$~ $_>&$;`
--pgp-sign-Multipart_Tue_Nov_23_09:45:02_1999-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
-----BEGIN PGP MESSAGE-----
Version: 2.6.3i
Comment: Processed by Mailcrypt 3.5.3, an Emacs/PGP interface
iQCVAwUBODpUGCRI0DH7ZPyzAQEEFgP/dU5DsOHnIHlnyCapri1Vq9VoIW90ZPZQ
6WngU69znCcoLrqe6pckomsYWdv2+oOwU8oBqST3Pt3AyfOZWXRVuiVDuUeh14eP
4OxUC8OWQf/6drHtsqpdT0BYtLubk3/O/MPkdCh4rBmXRPWBNGajJVXPFs0jpl18
s3hwLXZaSHY=
=yXCp
-----END PGP MESSAGE-----
--pgp-sign-Multipart_Tue_Nov_23_09:45:02_1999-1--