100% found this document useful (1 vote)
44 views

Foundations of Python Network Programming 3rd Edition Brandon Rhodes John Goerzeninstant download

The document is about the 'Foundations of Python Network Programming, 3rd Edition' by Brandon Rhodes and John Goerzen, detailing the book's contents, copyright information, and publication details. It covers various networking concepts such as client-server architecture, protocols like TCP and UDP, and practical applications like HTTP and email handling. The book serves as a comprehensive guide for understanding and implementing network programming in Python.

Uploaded by

omesiminore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
44 views

Foundations of Python Network Programming 3rd Edition Brandon Rhodes John Goerzeninstant download

The document is about the 'Foundations of Python Network Programming, 3rd Edition' by Brandon Rhodes and John Goerzen, detailing the book's contents, copyright information, and publication details. It covers various networking concepts such as client-server architecture, protocols like TCP and UDP, and practical applications like HTTP and email handling. The book serves as a comprehensive guide for understanding and implementing network programming in Python.

Uploaded by

omesiminore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Foundations of Python Network Programming 3rd

Edition Brandon Rhodes John Goerzen pdf download

https://ebookmeta.com/product/foundations-of-python-network-
programming-3rd-edition-brandon-rhodes-john-goerzen/

Download more ebook from https://ebookmeta.com


Foundations of Python
Network Programming

Third Edition

Brandon Rhodes
John Goerzen
Foundations of Python Network Programming, Third Edition
Copyright © 2014 by Brandon Rhodes and John Goerzen
This work is subject to copyright. All rights are reserved by the Publisher,
whether the whole or part of the material is concerned, specifically the rights
of translation, reprinting, reuse of illustrations, recitation, broadcasting,
reproduction on microfilms or in any other physical way, and transmission or
information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Exempted from this legal reservation are brief excerpts in connection with
reviews or scholarly analysis or material supplied specifically for the purpose
of being entered and executed on a computer system, for exclusive use by
the purchaser of the work. Duplication of this publication or parts thereof is
permitted only under the provisions of the Copyright Law of the Publisher’s
location, in its current version, and permission for use must always be
obtained from Springer. Permissions for use may be obtained through
RightsLink at the Copyright Clearance Center. Violations are liable to
prosecution under the respective Copyright Law.
ISBN-13 (pbk): 978-1-4302-5854-4
ISBN-13 (electronic): 978-1-4302-5855-1
Trademarked names, logos, and images may appear in this book. Rather
than use a trademark symbol with every occurrence of a trademarked name,
logo, or image we use the names, logos, and images only in an editorial
fashion and to the benefit of the trademark owner, with no intention of
infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and
similar terms, even if they are not identified as such, is not to be taken as an
expression of opinion as to whether or not they are subject to proprietary
rights.
While the advice and information in this book are believed to be true and
accurate at the date of publication, neither the authors nor the editors nor
the publisher can accept any legal responsibility for any errors or omissions
that may be made. The publisher makes no warranty, express or implied,
with respect to the material contained herein.
Managing Director: Welmoed Spahr
Publisher: Heinz Weinheimer
Lead Editor: Michelle Lowman
Technical Reviewers: Alexandre Beaulne and Peter Membrey
Editorial Board: Steve Anglin, Mark Beckner, Ewan Buckingham,
Gary Cornell, Louise Corrigan, Jim DeWolf, Jonathan Gennick,
Robert Hutchinson, Michelle Lowman, James Markham,
Matthew Moodie, Jeff Olson, Jeffrey Pepper, Douglas Pundick,
Ben Renow-Clarke, Dominic Shakeshaft, Gwenan Spearing, Matt
Wade, Steve Weiss
Coordinating Editor: Kevin Walter
Developmental Editor: Gary Schwartz
Copy Editor: Kim Wimpsett
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global
Cover Designer: Anna Ishchenko
Distributed to the book trade worldwide by Springer Science+Business Media
New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-
SPRINGER, fax (201) 348-4505, e-mail [email protected],
or visit www.springeronline.com. Apress Media, LLC is a California LLC
and the sole member (owner) is Springer Science + Business Media Finance
Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected], or visit
www.apress.com.

Apress and friends of ED books may be purchased in bulk for academic,


corporate, or promotional use. eBook versions and licenses are also available
for most titles. For more information, reference our Special Bulk Sales–eBook
Licensing web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in
this text is available to readers at www.apress.com. For detailed
information about how to locate your book’s source code, go to
www.apress.com/source-code/.
To my wonderful nieces, Avery, Savannah, and Aila,
remembering our bicycle ride and the wild abandon
with which they always round the corner and plunge
downhill.

I hope that they always approach life with such


fearlessness, whether they wind up doing any
network programming or not.
Contents at a Glance

About the Authors


About the Technical Reviewers
Acknowledgments
Introduction

Chapter 1: Introduction to Client-Server


Networking
Chapter 2: UDP
Chapter 3: TCP
Chapter 4: Socket Names and DNS
Chapter 5: Network Data and Network Errors
Chapter 6: TLS/SSL
Chapter 7: Server Architecture
Chapter 8: Caches and Message Queues
Chapter 9: HTTP Clients
Chapter 10: HTTP Servers
Chapter 11: The World Wide Web
Chapter 12: Building and Parsing E-Mail
Chapter 13: SMTP
Chapter 14: POP
Chapter 15: IMAP
Chapter 16: Telnet and SSH
Chapter 17: FTP
Chapter 18: RPC

Index
Contents

About the Authors


About the Technical Reviewers
Acknowledgments
Introduction

Chapter 1: Introduction to Client-Server


Networking
The Building Blocks: Stacks and Libraries
Application Layers
Speaking a Protocol
A Raw Network Conversation
Turtles All the Way Down
Encoding and Decoding
The Internet Protocol
IP Addresses
Routing
Packet Fragmentation
Learning More About IP
Summary
Chapter 2: UDP
Port Numbers
Sockets
Promiscuous Clients and Unwelcome Replies
Unreliability, Backoff, Blocking, and Timeouts
Connecting UDP Sockets
Request IDs: A Good Idea

Binding to Interfaces
UDP Fragmentation
Socket Options
Broadcast
When to Use UDP

Summary
Chapter 3: TCP
How TCP Works
When to Use TCP
What TCP Sockets Mean
A Simple TCP Client and Server
One Socket per Conversation
Address Already in Use

Binding to Interfaces
Deadlock
Closed Connections, Half-Open Connections
Using TCP Streams Like Files
Summary
Chapter 4: Socket Names and DNS
Hostnames and Sockets
Five Socket Coordinates
IPv6

Modern Address Resolution


Using getaddrinfo() to Bind Your Server to a Port
Using getaddrinfo() to Connect to a Service
Asking getaddrinfo() for a Canonical Hostname
Other getaddrinfo() Flags
Primitive Name Service Routines
Using getsockaddr() in Your Own Code

The DNS Protocol


Why Not to Use Raw DNS
Making a DNS Query from Python
Resolving Mail Domains

Summary
Chapter 5: Network Data and Network Errors
Bytes and Strings
Character Strings
Binary Numbers and Network Byte Order

Framing and Quoting


Pickles and Self-delimiting Formats
XML and JSON
Compression
Network Exceptions
Raising More Specific Exceptions
Catching and Reporting Network Exceptions

Summary
Chapter 6: TLS/SSL
What TLS Fails to Protect
What Could Possibly Go Wrong?
Generating Certificates
Offloading TLS
Python 3.4 Default Contexts
Variations on Socket Wrapping

Hand-Picked Ciphers and Perfect Forward Security


Protocol Support for TLS
Learning Details
Summary
Chapter 7: Server Architecture
A Few Words About Deployment
A Simple Protocol
A Single-Threaded Server
Threaded and Multiprocess Servers
The Legacy SocketServer Framework

Async Servers
Callback-Style asyncio
Coroutine-Style asyncio
The Legacy Module asyncore
The Best of Both Worlds

Running Under inetd


Summary
Chapter 8: Caches and Message Queues
Using Memcached
Hashing and Sharding
Message Queues
Using Message Queues from Python

Summary
Chapter 9: HTTP Clients
Python Client Libraries
Ports, Encryption, and Framing
Methods
Paths and Hosts
Status Codes
Caching and Validation
Content Encoding
Content Negotiation
Content Type
HTTP Authentication
Cookies
Connections, Keep-Alive, and httplib
Summary
Chapter 10: HTTP Servers
WSGI
Asynchronous Server-Frameworks
Forward and Reverse Proxies
Four Architectures
Running Python Under Apache
The Rise of Pure-Python HTTP Servers
The Benefits of Reverse Proxies

Platforms as a Service
GET and POST Patterns and the Question of REST
WSGI Without a Framework
Summary
Chapter 11: The World Wide Web
Hypermedia and URLs
Parsing and Building URLs
Relative URLs
The Hypertext Markup Language
Reading and Writing to a Database
A Terrible Web Application (in Flask)
The Dance of Forms and HTTP Methods
When Forms Use Wrong Methods
Safe and Unsafe Cookies
Nonpersistent Cross-Site Scripting
Persistent Cross-Site Scripting
Cross-Site Request Forgery
The Improved Application

The Payments Application in Django


Choosing a Web Framework
WebSockets
Web Scraping
Fetching Pages
Scraping Pages
Recursive Scraping

Summary
Chapter 12: Building and Parsing E-Mail
E-Mail Message Format
Building an E-Mail Message
Adding HTML and Multimedia
Adding Content
Parsing E-Mail Messages
Walking MIME Parts
Header Encodings
Parsing Dates
Summary
Chapter 13: SMTP
E-mail Clients vs. Webmail Services
In the Beginning Was the Command Line
The Rise of Clients
The Move to Webmail

How SMTP Is Used


Sending E-Mail
Headers and the Envelope Recipient
Multiple Hops

Introducing the SMTP Library


Error Handling and Conversation Debugging
Getting Information fromEHLO
Using Secure Sockets Layer and Transport Layer
Security
Authenticated SMTP
SMTP Tips
Summary
Chapter 14: POP
POP Server Compatibility
Discovering Diverse Content Through
Random Scribd Documents
One very notable difference, which may be pointed out again, is the
greater lightness and quickness of handling necessary to guide a
tandem with ease and safety through difficult places.
Tandem is therefore admirably adapted for ladies who are fond of
driving, as it affords all the interest of a team, without placing any
undue strain on their strength or powers of endurance, while it
enables them to exercise those qualities of quickness and lightness
of hands, in which as a rule they surpass men.
The whole art of driving is composed of innumerable small, though
most important details, but probably no other class of driving
requires so much attention to be paid to these minutiæ as Tandem.
FIG. 38.—TANDEM WITH BARS.
CHAPTER XI

TANDEM HARNESS.

Best kind of The harness should be as simple and as light as


harness
possible, consistent with strength. The colour is a
simple and
light. matter of taste and convenience, but perhaps for
country work brown with brass mounts is the most
suitable, whereas for driving in the Park black harness is almost de
rigueur. Certainly for soldiers at home, and more especially abroad,
brown is far the most useful, because it is a part of every mounted
soldier’s training to clean this kind of leather.
Wheel The wheeler’s harness is an ordinary single set with one
harness.
or two trifling additions, none of which are absolutely
necessary. These are two brass rings or loops fixed under the trace
buckles, into which are fastened the spring hooks of the leader’s
traces, and terrets on the pad divided by a roller to separate the
reins. For the former short pieces of leather can be substituted,
which have holes punched in one end, through which the tongues of
the trace buckles pass, while at the other end are sewn metal rings
Lead to take the hooks of the leader’s traces. The leader
harness.
should have a pad of rather lighter make than the
wheeler, with two fixed leather loops, one at each side, for the traces
to run through. There must also be a bearing-strap passing over the
horse’s loins, and this should be just long enough to keep the traces
level.
Lead traces.The traces are usually made long enough to be fixed to
the loops on the wheeler’s traces, as already described. This is the
simplest and most economical plan, but another method consists in
having two swingle bars, by means of which the leader’s traces can
be reduced to the same length as those of the wheeler.
Swingle The first of these bars, which is about two feet six
bars.
inches in length, has a large hook about five inches
long fixed in its front, and a light chain about one foot long attached
at the back. The chain is hooked to a ring in the bottom of the
wheeler’s hames, and is intended to prevent the bar from falling
down. At each end of the bar are two short traces about two feet
long, which hook into the wheeler’s trace in the same way as
previously described for the long ones.
Advantages The second bar is a light swingle-tree about two feet in
of swingle
bars over
length, having an eyelet to attach it to the hook of the
long traces. other bar.
Advocates for this system claim that it is less dangerous than the
other, because neither horse can get a leg over the trace, nor can a
trace wrap round the leader’s quarter if he swings suddenly round to
study the view in rear. The second method however entails more
expense and trouble than the first, which with careful driving need
rarely be the cause of accidents.
Traces The leader’s traces are sometimes hooked to the points
hooked to
of the shafts, but as this is a most dangerous system it
shafts
dangerous. should never be employed.
I have seen tandem traces extemporized out of ordinary single-
harness traces and pole chains, the latter bridging the gap between
the wheeler’s traces and the leader’s. This arrangement looked very
smart, but must make the lead traces too heavy.
Breast Although not so smart as a collar, breast harness can
harness.
be used in tandem equally as well as in single harness,
and as it can be adjusted to fit any horse its use avoids the necessity
of spending money on numerous collars. It also comes in very useful
when a horse’s shoulders have been wrung by a collar (see Chap.
I.).
Length of The length of the leader’s traces should depend on the
lead traces.
length of the horses and also on their action. They
should be as short as possible, but not so short as to make the
wheeler appear to be stepping on the leader. Three feet from nose
to croup seems to be about the right distance when the leader is in
draught.
Hooking up While on the subject of the leader’s traces it may be
lead traces.
well to point out that the best way to hook them up,
when putting to or taking out the leader, is to pass the end of the
trace from outside under and over itself just in front of the bearing-
strap, and then fasten the hook to the ring of the hames.
How to As regards the fastening up of the lead reins, it is usual
fasten up
to take a loop in the end of the rein and pass it through
lead reins.
the terrets of both pad and hames, so adjusting it that
no spare end hangs down by itself. The loop will be about the right
length if the end of the rein is brought up to the terret on the pad,
the end of the loop thus made being then put through the terrets as
described above.
Driving bits. The best bits for all-round work are either the Liverpool
Wheeler’s or the elbow-bits, but the wheeler’s should be made
bit.
with a light bar across the bottom of the cheek pieces.
This prevents the wheeler from catching the lead rein under the end
of the cheek piece, which constantly happens if he is inclined to
shake his head about, and has the effect of pulling the leader
Bit catching sharply to one side. It is, moreover, very difficult to get
in rein.
the rein free when caught in this way without getting
down. I think, as a rule, it is a good plan to pass the lead reins
through the loops of the bearing-rein of the wheeler, instead of
Lead reins through D’s fixed on his head-collar or throat-lash. The
through
loops should hang down about four inches, and be
bearing-rein
loops. quite loose, so that the wheeler can toss his head to a
considerable extent without violently jerking the leader
in the mouth. It is unnecessary to pass the reins through the terrets
on the hames, as bringing them straight back to those on the pad
gives a better lead.
Of course, if the wheeler habitually shakes his head about very
much, either up or down, or both, then a martingale and a bearing-
rein must be put on, which will effectually stop his little game.
Lead reins Never drive with the lead reins buckled, as, if the leader
never to be
buckled.
breaks either the traces, or the bar (if he has one), by
kicking or falling, the reins will run through the terrets,
and the horse can then get clear away, and a worse accident be
Leader’s tail avoided. Should the leader get his tail over a rein, a
over rein.
good way of getting it clear is to pull the wheeler well
across to the side on which the rein is fast, and the leader rather
over to the opposite side, slacking at the same time the fixed rein as
much as possible. By this manœuvre the rein will often come loose.
If it does not, try hitting the leader on the quarter with the whip,
when he will probably swish his tail and allow the rein to drop.
Tandem The whip is generally a rather lighter and shorter one
whip.
than that used for four horses, though the same can
perfectly well be used. The usual lengths of stick and lash are about
five and ten feet respectively. As to the correct method of holding
and handling it the reader must kindly refer to a former chapter,
where it is fully discussed. The principles are obviously exactly the
same.
FIG. 39.—LONGEING WITH LONG REINS.
CHAPTER XII

BREAKING TO HARNESS.

Accustom In conclusion, a few hints as to breaking a horse to


horse to
harness may be useful to those who have had no
harness in
stable. experience in giving a young horse his first lessons. In
the first place, it is a good plan to put the harness on in
the stable, and let the horse stand with it on for a time, with his
head on the pillar reins.
In India I found that with Australian horses, even those trained to
military draught, it was absolutely necessary to accustom them to
blinkers before attempting to drive them. They should be made to
stand in their stables, fed and taken out to water, and exercised with
blinkers on, previously to their being driven for the first time,
otherwise they will almost invariably jib.
Longeing After the pupil is accustomed to his harness, he should
with long
reins.
be taken out and longed with two long reins (fig. 39),
never with one only. These can be conveniently made
of webbing, like a common single longeing rein, but the lead reins of
a tandem will also answer the purpose. The horse should have a
body roller on with two rings or loops about half way down each
side, though an ordinary single-harness driving pad with the tugs on,
or a saddle with the stirrup irons fixed up for loops, can be
substituted. In all cases a crupper should be used.
Use snaffle It is always advisable to have a fairly loose standing
and
martingale on the bit, which should be a large smooth
martingale.
snaffle, the martingale being so adjusted that it will keep the bit on
the bars of the mouth, and will not allow the horse to get his head
up sufficiently high to cause the bit to press only on the corners of
his lips.
Bearing- It is also advisable to put on bearing-straps like those
straps.
of a tandem leader, in order to keep up the reins. The
long reins should be passed through the loops of the bearing-straps,
then through the rings on the roller, the tugs on the pad, or the
stirrup irons of the saddle, as the case may be, and then buckled on
to the bit.
Use whip The horse can now be driven about and be kept up to
when
longeing.
his bit with the whip, which the operator should always
have in his hand.
Keep him circling with the outer rein round his quarters above his
hocks. This will teach him to go collectedly, and enable the driver to
keep his quarters well in towards the centre, preventing him from
passing off sideways like a crab. It is impossible to attain this object
with a single rein, which also would have the effect of teaching him
to go on his shoulders.
Another point about having the rein against the horse’s quarters is
that it teaches him not to kick at the trace or breeching.
Do not longe If he should very much resent having the outer rein on
too long on
his hocks, begin by driving him with this rein over his
one rein.
back. He should not be kept circling too long on one
rein, but be often changed from one side to the other. If, however,
one side of his mouth is harder than the other, he should be made to
turn to that side for a longer period, until he turns equally well both
ways.
When the horse has learnt to answer the rein at once, and turn
equally well to both sides, he should be taught to rein back.
When this has been successfully accomplished, bring him out with
his harness on and long traces like lead tandem traces.
Have two Tell off two men to hang on to these while he is being
men pulling
driven about. By this means the amount of pressure
against
traces. can be regulated, and as only a small amount need be
applied to begin with, the horse will become gradually
accustomed to pulling with his shoulders. It is impossible to begin
too gradually; although some horses can be taken out of the stable
Jibbing and put into a break or a coach at once and will go
taught by
fairly well, others will be rendered jibbers for ever by
undue hurry.
this too hurried process.
Horse- In India a young horse is generally given his first
breaking in
lessons harnessed to a block of wood. The block of
India.
wood is triangular in shape, and in front of it is fixed a
long splinter bar. The horse’s traces are hitched to this, and the
breaker, standing on the block of wood, drives his pupil about until
he is quiet enough to be put in a cart. A short pole, with a cross bar
at the top like a parrot’s perch, is fixed to the front of the block, to
enable the driver to steady himself and prevent his being jolted off.
This is not at all a bad way of breaking a horse, as he cannot do
much harm by kicking or plunging, and the block being very light
does not teach him to jib.
Steady horse The horse having been taught to pull is now quite fit to
alongside
be driven in a break or cart. If possible, place him at
youngster.
first in a double break, with a steady old horse
alongside of him, which will do all the starting by steady pulling and
not by jumping into the collar. Many old break horses are quite up to
watching the young one, and start accordingly.
Never forget to have a bearing-rein on, also kneecaps and
bandages.
Accustom to Drive the youngster on both sides of the pole for a
both sides of
time, when he should be quite fit to put into a single-
pole.
harness break or cart.
Always have a rope halter on a young horse under the bridle the first
few times that he is put to. If he is likely to be very violent, two
halters may be put on, and you can then have a man leading him on
each side.
Take young It is far better to drive him where there is some traffic
horse among
than along a deserted country road, for he will go much
traffic.
better if he sees other things moving about, as they will
distract his attention, and keep him from playing tricks on the driver.
Exercise It is advisable to have him well exercised before
before giving
attempting to give him any of the above lessons.
lesson.
Breaking in Supposing that there is no double break available, use
single cart. a strong light cart with extra strong shafts instead; but
a heavy cart with no springs is bad, as it will make a rattling noise
and possibly frighten the novice, while its weight may teach him to
jib.
In this case put a good strong kicking-strap on, but be careful not to
buckle it down too tight, or it will catch his quarters if he should
canter, and perhaps induce him to kick.
The bearing-rein must be loose, but tight enough to prevent him
from getting his head close in to his chest. A loose martingale may
also be added if the horse has a tendency to put his head up; fasten
this to the nose-band.
Two men to Have a couple of men to hold him, and try and put him
assist in
in without the shafts touching him anywhere. Hold the
putting to.
shafts well up, and get the horse as nearly under them
as possible, and quite straight in front of the cart; then lower them
quietly and run the cart up, passing the points of the shafts through
the tugs.
Hook traces Next hook the traces and buckle the kicking-strap on as
before
quickly as possible. One man should be kept standing
buckling
kicking- in front of the horse and holding his head the whole
strap. time, and he should never move away until the driver is
ready to start. It is a good plan at this stage to lead the horse about
by the rope halter, with a man on each side ready to assist, while the
driver walks with the reins in his hand on the off side of the cart. He
can thus guide him without getting up, while the weight which the
horse has to pull to begin with is materially reduced.
When quiet If he goes along all right, mount into the cart and drive
get up into
cart.
him about, keeping a man running alongside for a little,
when, if he continues to go well, the man can jump up
behind. If he should be inclined to jib, have him led on at once, but
do not hit him. Never let the man lead him by the rein, but invariably
Turning by the nose-band or halter. When he has gone well for
lesson.
some distance on the straight, teach him to turn. Begin
by turning him if possible on a very large circle. If this cannot be
done, have him led round very slowly, the man pushing the outer
shaft at the same time to assist him, as in turning the inner one is
bound to catch him on the shoulder, when he will most probably
passage off sideways or rein back and get frightened.
How to start With a horse that continues to jib from sheer
a jibber.
cussedness, I have found that strapping up one leg,
and making him stand still until he is tired out, will often induce him
to start off perfectly quietly as soon as the leg has been released.
A rope crupper may also be tried with good effect. This is formed by
taking an inch rope about sixteen feet long and doubling it. The loop
is tied by a thumb-over-hand knot, forming a crupper about two feet
long. Pass the loop under the tail and bring the ends forward, one
on each side; then put a man to pull on each of these ends, and the
horse will most probably move forward at once.
This system is a very useful one for getting refractory horses into a
stable or loose box. In Ireland it is a common practice to rub some
gravel in a jibber’s mouth, and this appears to be effective at times.
When a horse is inclined to kick on first being put in harness, he can
often be prevented, if not cured, by holding, or even tying up a leg,
as in the case of a jibber.
How to If the horse is likely to be a hard puller, it is a good plan
guard
against
to have a Liverpool bit in his mouth, with two pairs of
pulling. reins, one buckled to the cheek and the other to the
bar, the latter only being used to check him if he is pulling too hard.
Lessons The lessons must be continued without intermission
must be
continuous.
daily for some considerable time, or else it will be found
that the pupil very soon forgets what he has been
taught.
How to fix At the conclusion of the lesson, after getting out of the
up reins
cart, place the reins over the off terret to prevent them
when taking
out of cart. from falling on to the ground when the horse is being
led into the stable. Take care that the spare parts,
which hang down on each side of the terret, are well in front of the
stop on the shaft; otherwise, if the horse should by any chance jump
Rein to the front while the cart is being run back, the rein
catching apt
to cause an
may get caught round the stop and give a sharp jerk to
accident. the horse’s mouth, which will probably frighten him.

FIG. 40.—A BREAK BY HOLLAND AND HOLLAND.


Horses that have once been frightened in this way seldom forget it,
and are apt to plunge forward directly they think they are clear of
the traces, which is a constant source of accidents, as the horse may
only get half out of the shafts, and then he will probably bolt. For
this reason the kicking-strap must always be unbuckled before the
traces are unhooked.
How to The best way of breaking a horse of this very bad habit
prevent
is to drive him straight up to a wall, or into a corner
horse
plunging where he cannot jump forward; then unhook the traces
forward out and run the cart back.
of shafts.
Accustom A horse that is to be driven in the lead of a team can
be to some degree accustomed to the bars, by having
horse to bars
in stable. one tied on so as to hang down and touch him just
above his hocks when standing in the stable.
In conclusion, I would remind the reader that “Prevention is better
than cure,” and in breaking a horse to harness every precaution
should be taken from the very beginning of his education, for when
a young horse has once been hurt or frightened, it is a very difficult
thing to persuade him that the same thing may not occur again, and
many a naturally quiet and generous horse is ruined for harness
work, or rendered nervous for life, simply owing to carelessness or
to want of ordinary precautions during his first two or three lessons.
The beginner who has mastered the foregoing pages will, I trust,
find that he is thoroughly grounded in the theory and principles of
driving, and his interest will, I hope, be roused to such an extent as
to induce him so to turn theory into practice, that with time and
perseverance he will develop into a neat and skilful whip.
CHISWICK PRESS:—CHARLES WHITTINGHAM AND CO.
TOOKS COURT, CHANCERY LANE, LONDON.
HINTS ON DRIVING.

Press Opinions on the First Edition.

From The Times.

“Another book which will appeal to all who are interested in horses is the capital
little volume called ‘Hints on Driving,’ by Capt. Morley Knight, R.A. Captain Knight
has nothing to do with history or anecdote; his work is entirely practical. Doubtless
there are other books on the subject, but none within our knowledge is more clear
or complete in the instructions given for driving in single or double harness, and,
above all, for the more difficult mysteries of four-in-hand or tandem driving. The
utility of the volume is much increased by the accurate vignette illustrations of
hands holding reins, etc., made by G. H. A. White, Royal Artillery.”
“Captain Knight is the author of a thoroughly practical book entitled ‘Hints on
Driving,’ which he dedicates to Major-General Albert Williams.”—Morning Post.
“There are perhaps few greater masters of the detail of the art than the
author.”—The Sportsman.
“One conspicuous and excellent feature is that it takes nothing for granted, etc.
Altogether this little volume is a capital manual of its kind.”—Glasgow Herald.
“It is simple, practical, and instructive. So far as the delicate art of handling the
ribbons can be taught by a book, this book succeeds to the best effect in teaching
it.”—Scotsman.
“Any who are deficient or novices in the art of driving—and it is an art—will do
well to inwardly digest the contents of a capital volume by Captain Knight, R. A.,
whose practical advice, down to the veriest minutiæ, will work wonders in a short
space.”—Sporting Life.
“Captain Knight has done as much as anyone could do to place before his
readers the more or less accepted canons of driving. The book costs but little
money, and anyone who wants to drive properly would do well to invest his 3s.
6d., and commit to memory some of the principal rules.”—The Field.
“A very businesslike and pleasant little book it is. Captain M. Knight’s little book
will be found far more serviceable than the big work on Driving in the ‘Badminton
Library.’ The book is provided with copious illustrations and diagrams.”—National
Observer.
“The advice and details afforded by Captain Knight are about as succinct, clear,
and reliable as those which any pupil can desire to acquire.”—The Road.
“We have come to the conclusion that the author has accomplished his design
with no little success, and that anyone who desires to drive properly would be well
advised to study Capt. Knight’s pages attentively before spending much money in
driving lessons.”—Baily’s Magazine.
“Much which it is very necessary for the learner to know may be acquired from a
writer who is sufficient master of his pen and of his subject to make his meaning
clear. Such an one is Captain C. Morley Knight, R.A., whose ‘Hints on Driving,’
published by Bell and Sons, will supply a long-felt want.”—Referee.
“The neophyte in handling the ribbons has found an excellent friend in Captain
C. M. Knight, R.A., whose ‘Hints on Driving’ are exactly what the beginner needs.
Capt. Knight is a master in the art, and whatever he says is the fruit of practical
experience.”—Army and Navy Gazette.
“Quite fulfils its author’s object,—namely, to explain to beginners the
rudimentary principles and niceties of driving.”—United Service Gazette.
“A most useful, practical, and handy little work on all that appertains to driving
in single and double harness—including four-in-hand and tandem driving.”—Broad
Arrow.
“We have not for some time come across such a thoroughly practical and sound
handbook as this.”—Admiralty and Horse Guards Gazette.
“This little octavo volume should have an immense sale in India, where every
household keeps its trap. Herein is given information and instruction on every
conceivable point connected with the mysterious craft of Whip and Reins.”—The
Pioneer (Allahabad).
“It is pleasant to meet with a little volume like Captain Knight’s ‘Hints on
Driving,’ so erudite and yet so simple.”—Times of India.

LONDON: GEORGE BELL AND SONS.


Transcriber’s Notes:
Missing or obscured punctuation was corrected.
Unbalanced quotation marks were left as the author intended.
Typographical errors were silently corrected.
Inconsistent spelling and hyphenation were made consistent
only when a predominant form was found in this book.
*** END OF THE PROJECT GUTENBERG EBOOK HINTS ON DRIVING
***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:

You might also like