twisted_network_programming_essentials.pdf

(9551 KB) Pobierz
SECOND EDITION
Twisted Network Programming
Essentials
Jessica McKellar and Abe Fettig
Twisted Network Programming Essentials, Second Edition
by Jessica McKellar and Abe Fettig
Copyright © 2013 Jessica McKellar. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Editor:
Meghan Blanchette
Production Editor:
Christopher Hearse
Copyeditor:
Rachel Head
Proofreader:
Amanda Kersey
March 2013:
Second Edition
Indexer:
Bob Pfahler
Cover Designer:
Randy Comer
Interior Designer:
David Futato
Illustrator:
Rebecca Demarest
Revision History for the Second Edition:
2013-03-11:
First release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449326111
for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc.
Twisted Network Programming Essentials,
2nd Edition, an image of a ball of snakes, and related
trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-32611-1
[LSI]
Table of Contents
Foreword to the First Edition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Part I.
An Introduction to Twisted
3
3
4
5
5
5
6
6
6
7
8
8
8
8
9
9
9
9
1. Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Installing Twisted
Installation on Linux
Installation on Windows
Installation on OS X
Installing from Source
Required Dependencies
Installing Twisted from a Release Tarball
Installing Twisted from a Source Checkout
Installing Optional Dependencies from Source
Testing Your Installation
Using the Twisted Documentation
API Documentation
Subproject Documentation
Finding Answers to Your Questions
Mailing Lists
IRC Channels
Stack Overflow
Twisted Blogs
A TCP Echo Server and Client
Event-Driven Programming
The Reactor
2. Building Basic Clients and Servers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
11
12
14
iii
Zgłoś jeśli naruszono regulamin