Learning Network Programming with Java 1st Edition Richard M Reese pdf download
Learning Network Programming with Java 1st Edition Richard M Reese pdf download
https://ebookmeta.com/product/learning-network-programming-with-
java-1st-edition-richard-m-reese/
https://ebookmeta.com/product/learning-network-programming-with-
java-1st-edition-richard-m-reese-2/
https://ebookmeta.com/product/neural-network-programming-with-
java-second-edition-fabio-m-soares/
https://ebookmeta.com/product/learning-reactive-programming-with-
java-8-1st-edition-nickolay-tsvetinov/
https://ebookmeta.com/product/smith-tanaghos-general-
urology-19th-edition-jack-w-mcaninch/
Foundations of Mathematics: A Preparatory Course Guido
Walz
https://ebookmeta.com/product/foundations-of-mathematics-a-
preparatory-course-guido-walz/
https://ebookmeta.com/product/economics-of-regulation-and-
antitrust-5th-edition-viscusi-w-kip-harrington-jr-joseph-e-
sappington-david-e-m/
https://ebookmeta.com/product/beginning-power-bi-2nd-edition-dan-
clark/
https://ebookmeta.com/product/dr-bad-boy-1st-edition-ainsley-
booth-sadie-haller/
https://ebookmeta.com/product/the-book-of-oberon-a-sourcebook-of-
elizabethan-magic-daniel-harms/
FTCE Social Science 6 12 037 Book Online 3rd Edition
Rhonda Atkinson
https://ebookmeta.com/product/ftce-social-science-6-12-037-book-
online-3rd-edition-rhonda-atkinson/
Table of Contents
Learning Network Programming with Java
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Getting Started with Network Programming
Network addressing using the InetAddress class
NIO support
Using the URLConnection class
Using the URLConnection class with buffers and channels
The client/server architecture
Creating a simple echo server
Creating a simple echo client
Using Java 8 to support the echo server and client
UDP and multicasting
Creating a multicast server
Creating the multicast client
Scalability
Creating a threaded server
Using the threaded server
Security
Creating a SSL server
Creating an SSL client
Generating secure keys
Summary
2. Network Addressing
Networking basics
Understanding network basics
Network architectures and protocols
Using the NetworkInterface class
Getting a MAC address
Getting a specific MAC address
Getting multiple MAC addresses
Network addressing concepts
URL/URI/URN
Using the URI class
Creating URI instances
Splitting apart a URI
Using the URL class
Creating URL instances
Splitting apart a URL
IP addresses and the InetAddress class
Obtaining information about an address
Address scoping issues
Testing reachability
Introducing the Inet4Address
Private addresses in IPv4
IPv4 address types
The Inet4Address class
Special IPv4 addresses
Introducing the Inet6Address class
Private addresses in IPv6
The Inet6Address class
Special IPv6 addresses
Testing for the IP address type
Using IPv4-compatible IPv6 addresses
Controlling network properties
Summary
3. NIO Support for Networking
Java NIO
Introduction to buffers
Using channels with a time server
Creating a time server
Creating a time client
The chat server/client applications
The chat server
The chat client
Server/client interaction
The HelperMethods class
Handling variable length messages
Running the chat server/client application
Handling multiple clients
The parts server
The parts client handler
The parts client
Running the parts client/server
Asynchronous socket channels
Creating the asynchronous server socket channel server
Creating the asynchronous socket channel client
Other buffer operations
Bulk data transfer
Using a view
Using read-only buffers
Controlling socket options
Summary
4. Client/Server Development
The HTTP protocol structure
The nature of HTTP messages
Initial request line format
Header lines
Message body
Client/Server interaction example
Java socket support for HTTP client/server applications
Building a simple HTTP server
Building a simple HTTP client
Client/server development using standard Java classes
Using the HttpURLConnection class
URL encoding
Using the HTTPServer class
Implementing a simple HTTPServer class
Managing response headers
Open source Java HTTP servers
Server configuration
Handling cookies
Summary
5. Peer-to-Peer Networks
P2P functions/characteristics
Applications-based P2P networks
Java support for P2P applications
Distributed hash tables
DHT components
DHT implementations
Using JDHT
Using FreePastry
The FreePastry demonstration
Understanding the FreePastryExample class
Understanding the FreePastryApplication class
Sending a message to a specific node
Summary
6. UDP and Multicasting
Java support for UDP
TCP versus UDP
UDP client/server
The UDP server application
The UDP client application
The UDP client/server in action
Channel support for UDP
The UDP echo server application
The UDP echo client application
The UDP echo client/server in action
UDP multicasting
The UDP multicast server
The UDP multicast client
The UDP multicast client/server in action
UDP multicasting with channels
The UDP channel multicast server
The UDP channel multicast client
The UDP channel multicast client/server in action
UDP streaming
The UDP audio server implementation
The UDP audio client implementation
Summary
7. Network Scalability
Multithreaded server overview
The thread-per-request approach
The thread-per-request server
The thread-per-request client
The thread-per-request applications in action
Thread-per-connection approach
The thread-per-connection server
The thread-per-connection client
The thread-per-connection applications in action
Thread pools
The ThreadPoolExecutor class characteristics
Simple thread pool server
Simple thread pool client
The thread pool client/server in action
Thread pool with Callable
Using a Callable
Using a Future
Using the HttpServer executor
Using a selector
Creating the selector
Registering a channel
Using the selector to support a time client/server
The channel time server
The date and time client application
The date and time server/client in action
Handling network timeouts
Summary
8. Network Security
Security
Secure communication terminology
Encryption basics
Symmetric encryption techniques
Generating a key
Encrypting text using a symmetric key
Decrypting text
Asymmetric encryption techniques
Generating and saving asymmetric keys
Encrypting/decrypting text using an asymmetric key
Saving asymmetric keys to a file
Creating a keystore
Creating and maintaining a keystore with keytool
Keytool command-line arguments
Creating and maintaining a keystore with Java
Symmetric encryption client/server
Symmetric server application
Symmetric client application
Symmetric client/server in action
Asymmetric encryption client/server
Asymmetric server application
Asymmetric client application
Asymmetric client/server in action
TLS/SSL
SSL server
SSL client
SSL client/server in action
Secure hash functions
Summary
9. Network Interoperability
Byte order in Java
Interfacing with other languages
Interfacing with JVM based languages
Interfacing with non-JVM languages
Communication through simple sockets
The Java server
The C# client
The client/server in action
Interoperability through middleware
Creating a RESTful service
Testing the RESTful service
Creating a RESTful client
Summary
Index
Learning Network
Programming with Java
Learning Network
Programming with Java
Copyright © 2015 Packt Publishing
Every effort has been made in the preparation of this book to ensure
the accuracy of the information presented. However, the information
contained in this book is sold without warranty, either express or
implied. Neither the author, nor Packt Publishing, and its dealers and
distributors will be held liable for any damages caused or alleged to
be caused directly or indirectly by this book.
Livery Place
35 Livery Street
ISBN 978-1-78588-547-1
www.packtpub.com
Credits
Author
Richard M Reese
Reviewer
Daniel MÜHLBACHLER
Commissioning Editor
Veena Pagare
Acquisition Editors
Vivek Anantharaman
Rahul Nair
Technical Editor
Humera Shaikh
Copy Editor
Priyanka Ravi
Project Coordinator
Shipra Chawhan
Proofreader
Safis Editing
Indexer
Production Coordinator
Nilesh Mohite
Cover Work
Nilesh Mohite
About the Author
Richard M Reese has worked in both industry and academia. For
17 years, he worked in the telephone and aerospace industries,
serving in several capacities, including research and development,
software development, supervision, and training. He currently
teaches at Tarleton State University, where he has the opportunity to
apply his years of industry experience to enhance his teaching.
Did you know that Packt offers eBook versions of every book
published, with PDF and ePub files available? You can upgrade to the
eBook version at www.PacktPub.com and as a print book customer,
you are entitled to a discount on the eBook copy. Get in touch with
us at <service@packtpub.com> for more details.
https://www2.packtpub.com/books/subscription/packtlib
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account
holders
If you have an account with Packt at www.PacktPub.com, you can
use this to access PacktLib today and view 9 entirely free books.
Simply use your login credentials for immediate access.
Preface
The world is becoming interconnected on an unprecedented scale
with more services being provided on the Internet. Applications
ranging from business transactions to embedded applications, such
as those found in refrigerators, are connecting to the Internet. With
isolated applications no longer being the norm, it is becoming
increasingly important for applications to be network enabled.
The goal of this book is to provide the reader with the necessary
skills to develop Java applications that connect and work with other
applications and services across a network. You will be introduced to
a wide range of networking options that are available using Java,
which will enable you to develop applications using the appropriate
technology for the task at hand.
What this book covers
Chapter 1, Getting Started with Network Programming, introduces
the essential network terminology and concepts. The networking
support that Java provides is illustrated with brief examples. A
simple client/server application is presented along with a threaded
version of the server.
New terms and important words are shown in bold. Words that
you see on the screen, for example, in menus or dialog boxes,
appear in the text like this: "Once NetBeans has been installed, start
it and then create a new project from the File | New Project…
menu item."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what
you think about this book—what you liked or disliked. Reader
feedback is important for us as it helps us develop titles that you will
really get the most out of.
If there is a topic that you have expertise in and you are interested
in either writing or contributing to a book, see our author guide at
www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a
number of things to help you to get the most from your purchase.
Errata
Although we have taken every care to ensure the accuracy of our
content, mistakes do happen. If you find a mistake in one of our
books—maybe a mistake in the text or the code—we would be
grateful if you could report this to us. By doing so, you can save
other readers from frustration and help us improve subsequent
versions of this book. If you find any errata, please report them by
visiting http://www.packtpub.com/submit-errata, selecting your
book, clicking on the Errata Submission Form link, and entering
the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our
website or added to any list of existing errata under the Errata
section of that title.
Questions
If you have a problem with any aspect of this book, you can contact
us at <questions@packtpub.com>, and we will do our best to address
the problem.
Chapter 1. Getting Started
with Network Programming
Access to networks (the Internet in particular) is becoming an
important and often necessary feature of applications. Applications
frequently need to access and provide services. As the Internet of
Things (IoT) connects more and more devices, understanding how
to access networks becomes crucial.
The important factors that have been the driving forces for more
network applications include the availability of faster networks with
greater bandwidth. This has made it possible to transmit wider
ranges of data, such as video streams. In recent years, we have
seen an increase in connectivity, whether it has been for new
services, more extensive social interactions, or games. Knowing how
to develop network applications is an important development skill.
InetAddress address =
InetAddress.getByName("www.packtpub.com");
System.out.println(address);
Tip
Downloading the example code
You can download the example code files for all Packt books you
have purchased from your account at http://www.packtpub.com.
If you purchased this book elsewhere, you can visit
http://www.packtpub.com/support and register to have the files
e-mailed directly to you.
www.packtpub.com/83.166.169.231
The number attached to the end of the name is the IP address. This
address uniquely identifies an entity on the Internet.
System.out.println("CanonicalHostName: "
+ address.getCanonicalHostName());
System.out.println("HostAddress: " +
address.getHostAddress());
System.out.println("HostName: " +
address.getHostName());
HostAddress: 83.166.169.231
HostName: www.packtpub.com
address.isReachable(10000);
A channel and a buffer are typically associated with each other. Data
may be transferred from a channel to a buffer or from a buffer to a
channel. The buffer, as its name implies, is a temporary repository
for information. The selector is useful in supporting application
scalability, and this will be discussed in Chapter 7, Network
Scalability.
There are several buffer classes that support primitive data types,
such as character, integer, and float.
try {
URL url = new
URL("http://www.google.com");
URLConnection urlConnection =
url.openConnection();
BufferedReader br = new BufferedReader(
new InputStreamReader(
urlConnection.getInputStream()));
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
br.close();
} catch (IOException ex) {
// Handle exceptions
}
The output is rather lengthy, so only part of the first line is shown
here:
The read method returns the number of bytes read. The ByteBuffer
class' array method returns an array of bytes, which is used as the
argument of the String class' constructor. This is used to display the
data read. The clear method is used to reset the buffer so that it
can be used again:
try {
URL url = new
URL("http://www.google.com");
URLConnection urlConnection =
url.openConnection();
InputStream inputStream =
urlConnection.getInputStream();
ReadableByteChannel channel =
Channels.newChannel(inputStream);
ByteBuffer buffer =
ByteBuffer.allocate(64);
String line = null;
while (channel.read(buffer) > 0) {
System.out.println(new
String(buffer.array()));
buffer.clear();
}
channel.close();
} catch (IOException ex) {
// Handle exceptions
}
The first line of output is shown next. This produces the same
output as before, but it is restricted to displaying 64 bytes at a time:
<!doctype html><html itemscope=""
itemtype="http://schema.org/We
After this client socket has been created, we can process the
message sent to the server. As we are dealing with text, we will use
a BufferedReader instance to read the message from the client. This
is created using the client socket's getInputStream method. We will
use a PrintWriter instance to reply to the client. This is created
using the client socket's getOutputStream method, shown as follows:
When text is written to a socket, it will sit in a buffer until either the
buffer is full or a flush method is called. Performing automatic
flushing saves us from having to remember to flush the buffer, but it
can result in excessive flushing, whereas a single flush issued after
the last write is performed, will also do.
The next code segment completes the server. The readLine method
reads a line at a time from the client. This text is displayed and then
sent back to the client using the out object:
String inputLine;
while ((inputLine = br.readLine()) != null) {
System.out.println("Server: " +
inputLine);
out.println(inputLine);
}
try {
System.out.println("Waiting for
connection.....");
InetAddress localAddress =
InetAddress.getLocalHost();
clientSocket.getInputStream()))) {
...
}
} catch (IOException ex) {
// Handle exceptions
}
Note
Localhost refers to the current machine. This has a specific IP
address: 127.0.0.1. While a machine may be associated with an
additional IP address, every machine can reach itself using this
localhost address.
The user is then prompted to enter text. If the text is the quit
command, then the infinite loop is terminated, and the application
shuts down. Otherwise, the text is sent to the server using the out
object. When the reply is returned, it is displayed as shown next:
System.out.println("Connected to server");
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.print("Enter text: ");
String inputLine = scanner.nextLine();
if ("quit".equalsIgnoreCase(inputLine)) {
break;
}
out.println(inputLine);
String response = br.readLine();
System.out.println("Server response: " +
response);
}
Connected to server
Enter text:
Enter a message, and watch how the client and the server interact.
The following is one possible series of input from the client's
perspective:
The server's output is shown here after the client has entered the
quit command:
String inputLine;
while ((inputLine = br.readLine()) != null) {
System.out.println("Client request: " +
inputLine);
out.println(inputLine);
}
MR. VAUGHAN filled his room completely without any aid from foreign
singers; and except a duet from Spohr’s Jessonda—which was not
well chosen for Mrs. Bishop and Mr. Horncastle—the music was
almost wholly in the native language of the performers. Giovanni
Croce’s madrigal, ‘Cynthia!’ was called for a second time, for
madrigals are coming into fashion again. Mrs. Bishop sang Hummel’s
Offertorium very chastely; and Miss Stephens, in ‘Sweet Bird,’
pleased every admirer of simplicity and pure intonation. Mr. Phillips’s
‘Old English Gentleman’ was received with a universal encore.
MR. MOSCHELES’,
Opera Concert Room, Wednesday Morning, May 1.
MRS. ANDERSON’s,
Opera Concert Room, Friday Morning, May 10.
M. HUMMEL’s,
Opera Concert Room, Monday Morning, May 13.
MR. F. CRAMER’s,
At the Hanover Square Rooms, Wednesday, May 15.
MADAME CELLINI’s,
Hanover Square Rooms.
Mad. Cellini sang in good taste a duet of Rossini with her pupil,
Miss Heath, and joined in other pieces. Mad. Pasta, Mad. Devrient,
Signori Zuchelli, De Begnis, Mr. Parry, jun., Mr. Bennett, &c., assisted
in the vocal department. M. De Beriot played very finely a violin solo;
and a M. Dorn made his first appearance in London, in a solo for the
horn. He is a master of his instrument, but not so great a master as
Puzzi.
This was not very fully attended, but Mr. Dressler and Mr. Pelzer
on their respective instruments very much delighted their audience.
MISS DORRELL’s,
At the residence of Sir Giffin Wilson, Stratford Place, Wednesday
Evening, May 15.
Miss Dorrell, late a pupil of the Royal Academy of Music,
performed Hummel’s piano-forte concerto in A minor, also the
principal part in his military septet, in a very correct, neat manner.
The rest of the concert was vocal; among the pieces were ‘Ah! come
rapida!’ and a Tyrolienne, by Mad. Cinti, an aria, by Signor Zuchelli, a
duet by the latter and Signor De Begnis, a serenade by Mr. Bennett,
composed by Lord Burghersh, &c. A numerous and elegant company
attended this concert.
M. KIALLMARK’s,
Opera Concert Room, Thursday Morning, May 16.
M. MORI’s,
Opera Concert Room, Friday Evening, May 17.
M. CIPRIANI POTTER’s,
Opera Concert Room, Friday Morning, May 24.
M. HENRI HERZ’s,
Opera Concert Room, Wednesday Morning, May 29.
MR. SALAMAN’s,
Hanover Square Rooms, Thursday Evening, May 30.
MR. SALE’s,
Hanover Square Rooms, Friday Morning, May 31.
M. SEDLATZEK’s,
At the residence of J. Taylor, Esq., George Street, Hanover Square,
Saturday Morning, June 8.
Mr. J. B. CRAMER’s,
Opera Concert Room, Friday Morning, June 14.
BERLIN.
A YOUNG singer, Mad. Schodel, from Vienna, has made her first
appearance at the Königstadt theater; her voice, which is of an
agreeable quality, is rather weak, particularly in the lower notes; she
has, however, considerable flexibility, and she sings simple melodies
with exquisite sweetness and taste; her acting, moreover, is very
good. There has been no novelty at this theatre of late; the operas
of Melusine and Des Adler’s Horst have been the principal
attractions.
A new opera has been produced at the Königliche theater, Das
Schloss Candra (Candra Castle), by Joseph Wolfram, which was
rather favourably received. The music makes no pretensions to
genius, at the same time the opera contains much that is very
meritorious; the choruses, if not beautiful, are at least good, and the
same may be said of the concerted pieces; the arias, however, are
weak. The other performances have been, Alcidor, Die Stumme, and
Fra Diavolo.
DRESDEN.
THE unceasing efforts of the Kapellmeister Reissiger have led to an
engagement as a compensation for the temporary loss of Mad.
Schroeder Devrient, whose characters will be sustained during her
three months’ absence by Mad. Kraus Wranitzky; Mlle. Maschinka
Schneider is also engaged for one year. The opera, however,
experiences an irreparable heavy loss in the departure of Mad.
Schebest, who appeared for the last time as Irma, in Der Maurer
und der Schlosser (le Maçon.)
On Palm Sunday there was a grand performance of Bach’s
oratorio, St. Matthew the Evangelist, at the great opera house, under
the very able direction of Kapellmeister’s Morlacchi and Reissiger, in
aid of the fund for the relief of the distressed widows and orphans of
members of the Royal Chapel; the choruses consisted of upwards of
two hundred voices, and there were ten eminent solo singers—
among them, Mesdames Kraus Wranitzky and Schebest; the tenors,
Babnigg and Schuster, and the bases, Risse, Wächter, and Zezi; and
upwards of a hundred instruments judiciously proportioned.
FRANKFORT.
MLLE. Carl has arrived here, and has sung at a concert which,
notwithstanding her fame, was but thinly attended. On the 15th April
M. Kalkbrenner gave a concert and was received with enthusiasm.
BREMEN.
THE winter concerts, which were very successful, having terminated,
there was a benefit concert got up for Mad. Mühlenbruch, the
principal singer, who has a sweet voice and exquisite taste. On Good
Friday, the Messiah was given in the cathedral, when Mad. M. and
the younger Mlle. Graban, and some talented dilettanti, did justice to
the music of the immortal Handel.
DUSSELDORF.
IT is expected that the musical festival which is to take place this
year will be one of the most brilliant on record for many years.
Among the attractive pieces which are announced for performance,
are Mozart’s symphony in G minor, the overture to Leonore, by
Beethoven; Handel’s oratorio, Israel in Egypt; a cantata by Wolf; and
Die Macht der Töne (the Power of Sounds), by Weber; and some
compositions of M. Bergmuller and of M. Felix Mendelssohn, director
for the present year. Mad. Decker (late Fraul. von Schätzel) is to sing
on the occasion.
DESSAU.
FOR some years past few foreign artists of eminence have played at
our concerts; the recent visit therefore of M. Haase, jun., from
Dresden, was the more welcome, from the rarity of such
occurrences. He played a fantasia by Molique, on Swiss airs, a duet
by Lafont and Hertz, from Fra Diavolo, and Mayseder’s Thema, with
variations in D major. His tone is full of exquisite expression, his style
remarkable for elegance and freedom, his cantilena is exceedingly
grand, and his bowing masterly, like that of Polledro his instructor.
JENA.
OUR usual concerts and musical entertainments under the direction
of Dr. Hand have given great satisfaction. A concert by the Vocal and
Instrumental Society was the first of the season. The selection
comprised an overture by Reissiger and one by Lindpaintner, and
concertos of Hummel on the piano-forte, Keller on the flute, and
Jansa on the violin, all played by dilettanti.
Mad. Filipowicz gave a concert, at which she played a polonaise
by Kalliwoda with much feeling, and Mayseder’s variations in E major.
There was also a musical entertainment given by M. Rössner of
Darmstadt, and MM. Buschmann, father and son, the former playing
the harp, the other the terpodion.
UTRECHT.
AT the two hundredth anniversary of our City Concerts, on the 14th
March, was performed a cantata composed by M. Kufferath, a pupil
of Spohr’s. The performance was conducted by the composer and
surpassed every expectation; there were also given a symphony of
Kalliwoda, and Mendelssohn Bartholdy’s overture to a Midsummer
Night’s Dream, which were well played.
ST. PETERSBURG.
A CONCERT was lately given at the palace of M. von Narischkin, for the
relief of the widows and orphans of musicians, at which several
dilettanti of rank, namely, Prince Wolchonski, Count M. Wielhorsky,
Mlle. von Bolotnikow, and others, contributed their valuable services.
COPENHAGEN.
THE season just past brought before the public two new operas
which were very successful; the first Das Bild und die Büste (the
Portrait and the Bust), in three acts, by P. C. Berggreen, the other,
Die Braut von Lammermoor, by the Kapellmeister J. Bredal; both
composers in their productions successfully clothed in musical
expressions the ideas of their poets, regarding melody as the first
consideration—in style however they differ widely. Besides these,
there was another vocal piece, Der Rabe oder die Bruderprobe (The
Raven, or the Test of Fraternal Affection), by J. P. E. Hartmann. The
other performances of the season were Boieldieu’s Die Zwey Nächte
(Les deux Nuits), J. L. Heiberg’s humorous operetta, Ein Abentheuer
im Rosenberger Garten (An Adventure in the Rosenberg Garden),
Weyse’s opera, Ludlam’s Höhle (Ludlam’s Cave), Die Stumme, Fra
Diavolo, Der Liebestrank, Die Weise Frau, Figaro, Joconde, Die
Weinlese (The Vintage), Der Erlenhügel (The Alder Hill), music by
Kuhlau; Don Juan, Das Schloss Montenero, Der Schatz (Le Trésor
Supposé), Der Schlosser und der Maurer, Preciosa, Der kleine Matros
(Le petit Matelôt), and Die verliebten Handwerksleute (The Love-
smitten Mechanics.)
MADRID.
ITALIAN operas are performed here twice a week, alternately in the
Teatro del Principe and in the Teatro della Cruz; thus the lovers of
the opera are obliged to take boxes in both houses. None, indeed,
but Italian operas are tolerated, and Rossini is the favourite
composer. Hence piano-forte arrangements of his music are to be
met with all over Madrid, and there is scarcely a female of the
middle rank in life who has not acquired some degree of proficiency
on the piano-forte. The guitar is almost entirely discarded. People
alone of the lower class are now and then to be seen playing that
instrument before their doors. Spanish music, too, is completely out
of vogue, and the ladies invariably sing that of Italy, unless expressly
entreated to sing a national air; so that the lively Spanish airs are
now only to be heard in the mouths of the common people.
THE DRAMA.
KING’s THEATRE.
THE Pirata of BELLINI, which is not only his best opera, but the only
one of that composer which has a chance of surviving above another
year or two, has been performed since our last report, Madame
PASTA in the character of Imogene, who enabled us to enter fairly
into the merits of the work, which, at its first representation in this
country four seasons ago, were not so discernible, the then prima
donna having made a very sad affair of it, though she was amazingly
bepraised at the time, and we were exceedingly vituperated for
pointing out her incapability.
Fragments of operas have also been performed; the best works
have suffered all kinds of mutilations and martyrdom, and the
audiences have been content, which is a sufficient justification of the
manager. The fact is that in the months of May and June the opera
fills, however conducted. A really good manager directs his efforts to
the first few months of the season, well knowing that after Easter a
single great name is sufficient to draw crowds.
On Thursday the 20th of June, a new opera was actually
produced—the first attempt of the kind this season! The occasion
was Madame PASTA’s benefit; the name of the piece, Norma, a tragic
opera in two acts, composed by Signor BELLINI, and got up under his
personal direction.
The following are the characters:—
Pollione, Pro-Consul of Rome, in Cambria, Sig. DONZELLI.
Oroveso, Chief of the Druids Sig. V. GALLI.
Norma, Druidess, daughter at Oroveso Mad. PASTA.
Adalgisa, a young priestess Mad. DE MERIC.
Clotilde, confidante of Norma Mad. CASTELLI.
Flavio, friend of Pollione Sig. G. GALLI.
‘The scene lies in Cambria, in the sacred forest, and in the
Temple of Irminsul.’
The story is as wide a departure from anything in the shape of
historical vraisemblance as can be imagined. The Gauls subjugate
the Romans in Wales, then commit the government of that country
to Pollio, a pro-consul of Rome! He becomes enamoured of Norma,
daughter of the Arch-Druid, and is secretly married to her, though
she, something like the Vestal virgins, had devoted herself to
celibacy. After she has become the mother of two children, Pollio’s
affections are transferred to Adalgisa, who consents at first to fly
with him to Rome; but, struck by remorse, she reveals all to Norma,
whose ‘love to hatred turns,’ and the latter determines to avenge
herself by destroying her children; but she changes her purpose;
impeaches herself in the assembly of Druids, and is condemned to
be burnt alive; to which fate her faithless husband is also sentenced;
but his love for her suddenly returns, and he unreluctantly ascends
with Norma the fatal pile.
That this is an imitation of Medea is evident, and, as in that
opera, Madame PASTA is the life and soul of this. Her acting alone
saves it here, as it did in Milan, where it was first produced last year.
Considered as a whole, the music, though not censurable in
regard to the rules of composition, possesses the most fatal of all
faults—it is deplorably uninteresting: except the motivo of the duet,
Deh! con te li prendi, an aria, Norma! che fu? and the finale, not a
piece has the slightest pretence to originality, or produces the least
effect. The overture and introduzione stun one with all kinds of noisy
instruments, and half, or more, of the first act is accompanied by the
same intolerable din. The music of the last scene, and the acting of
PASTA, but especially the latter, will keep the opera on the stage while
she remains to fill the part; without her, or her equal, if such should
ever be found, it has no chance of being listened to in London; and
even with her, it is with a half reluctance permitted[70].
COVENT-GARDEN THEATRE.
THIS theatre closed very early last month, the lessee declaring
that, as the performers declined acceding to the terms he proposed,
he could no longer carry on the concern, without incurring the most
ruinous loss. The company then obtained the Lord Chamberlain’s
permission to open the Olympic, and transferred themselves to that
theatre, where they have since continued to perform. Shortly after,
this theatre was re-opened with the German company, brought
hither from Drury-lane, in consequence of an agreement between M.
LAPORTE and Mr. BUNN! Their first performance was MOZART’s
Zauberflöte, M. HAITZINGER as Tamino, who sung the airs with great
feeling, but was occasionally too loud and turbulent,—M. DOBLER, a
fine deep, musical base, and a very superior singer, as Sarastro,—
Madame SCHROEDER DEVRIENT as Pamina, who did the most ample
justice to the part,—Madame STOLL BÖHM, a soprano with an
indifferent voice, whose deficiencies as a singer are not
compensated for by her acting, as Astrifiammante,—and M. UETZ, a
very excellent actor, and a singer of great merit, as Papageno.
Though much of this opera was performed remarkably well, parts of
it disappointed our expectations: the two lovely trios, best known
here by the Italian words, ‘Te guida a palma nobile;’ and ‘Già fan
ritorno,’ were executed in but a slovenly manner, and the fine
religious march lost some of its effect by being played to an empty
stage. This, however, we believe, was afterwards corrected. The
Zauberflöte has not drawn, in spite of its many beauties, and the
German Opera is not in a much better condition in London than the
national, the legitimate drama!
THE MUSIC OF THE PRESENT
NUMBER.
THE titles of the pieces in this number leave us little to add, for as
four out of six of them are of modern date, their authors are well
known, and no history at all interesting is connected with those
compositions.
The cavatina is in the last scene of The Pirate, sung in the
character of Imogene, who addresses it to her young son. The
words are thus translated into not very good English verse, in the
printed book of the opera:—
BIOGRAPHICAL SKETCHES OF
MARIN MERSENNE AND
ATHANASIUS KIRCHER.
[Chiefly from HAWKINS’s and BURNEY’s Histories.]