100% found this document useful (3 votes)
16 views

Learning Network Programming with Java 1st Edition Richard M Reese pdf download

The document is a promotional and informational overview of the book 'Learning Network Programming with Java' by Richard M. Reese, which covers essential networking concepts and Java programming techniques. It includes chapters on network addressing, NIO support, client/server development, peer-to-peer networks, and network security, among others. The book aims to equip readers with the skills needed to develop network-enabled Java applications.

Uploaded by

suniacrais5n
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 (3 votes)
16 views

Learning Network Programming with Java 1st Edition Richard M Reese pdf download

The document is a promotional and informational overview of the book 'Learning Network Programming with Java' by Richard M. Reese, which covers essential networking concepts and Java programming techniques. It includes chapters on network addressing, NIO support, client/server development, peer-to-peer networks, and network security, among others. The book aims to equip readers with the skills needed to develop network-enabled Java applications.

Uploaded by

suniacrais5n
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/ 85

Learning Network Programming with Java 1st

Edition Richard M Reese install download

https://ebookmeta.com/product/learning-network-programming-with-
java-1st-edition-richard-m-reese/

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

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/

Neural Network Programming with Java Second Edition


Fabio M. Soares

https://ebookmeta.com/product/neural-network-programming-with-
java-second-edition-fabio-m-soares/

Learning Reactive Programming with Java 8 1st Edition


Nickolay Tsvetinov

https://ebookmeta.com/product/learning-reactive-programming-with-
java-8-1st-edition-nickolay-tsvetinov/

Smith & Tanagho’s General Urology 19th Edition Jack W.


Mcaninch

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/

Economics of Regulation and Antitrust 5th Edition


Viscusi W Kip Harrington Jr Joseph E Sappington David E
M

https://ebookmeta.com/product/economics-of-regulation-and-
antitrust-5th-edition-viscusi-w-kip-harrington-jr-joseph-e-
sappington-david-e-m/

Beginning Power BI 2nd Edition Dan Clark

https://ebookmeta.com/product/beginning-power-bi-2nd-edition-dan-
clark/

Dr Bad Boy 1st Edition Ainsley Booth Sadie Haller

https://ebookmeta.com/product/dr-bad-boy-1st-edition-ainsley-
booth-sadie-haller/

The Book of Oberon: A Sourcebook of Elizabethan Magic


Daniel Harms

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

All rights reserved. No part of this book may be reproduced, stored


in a retrieval system, or transmitted in any form or by any means,
without the prior written permission of the publisher, except in the
case of brief quotations embedded in critical articles or reviews.

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.

Packt Publishing has endeavored to provide trademark information


about all of the companies and products mentioned in this book by
the appropriate use of capitals. However, Packt Publishing cannot
guarantee the accuracy of this information.

First published: December 2015

Production reference: 1141215

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

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

Content Development Editor

Arshiya Ayaz Umer

Technical Editor

Humera Shaikh

Copy Editor

Priyanka Ravi

Project Coordinator

Shipra Chawhan

Proofreader
Safis Editing

Indexer

Monica Ajmera Mehta

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.

Richard has written several Java books and a C Pointer book. He


uses a concise and easy-to-follow approach to topics at hand. His
Java books have addressed EJB 3.1, updates to Java 7 and 8,
certification, functional programming, jMonkeyEngine, and natural
language processing.

I would like to thank my daughter, Jennifer, for her numerous


reviews and contributions; my wife, Karla, for her continued
support; and to the staff of Packt for their work in making this a
better book.
About the Reviewer
Daniel MÜHLBACHLER got interested in computer science shortly
after entering high school, where he later developed web
applications as part of a scholarship system for outstanding pupils.

He has a profound knowledge of web development (PHP, HTML,


CSS/LESS, and AngularJS), and has worked with a variety of other
programming languages and systems, such as Java/Groovy, Grails,
Objective-C and Swift, Matlab, C (with Cilk), Node.js, and Linux
servers.

Furthermore, he works with some database management systems


based on SQL, and also some NoSQL systems, such as MongoDB,
and SOLR. This is also reflected in several projects that he is
currently involved in at Catalysts GmbH.

After studying abroad as an exchange student in the United


Kingdom, he completed his bachelor's degree at Johannes Kepler
University in Linz, Austria, with a thesis on aerosol satellite data
processing for mobile visualization. This is where he also became
familiar with processing large amounts of data.

Daniel enjoys solving challenging problems and is always keen on


working with new technologies, especially related to the fields of big
data, functional programming, optimization, and NoSQL databases.

More detailed information about his experience, as well as his


contact details, can be found at www.muehlbachler.org and
www.linkedin.com/in/danielmuehlbachler.
www.PacktPub.com
Support files, eBooks,
discount offers, and more
For support files and downloads related to your book, please visit
www.PacktPub.com.

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.

At www.PacktPub.com, you can also read a collection of free


technical articles, sign up for a range of free newsletters and receive
exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is


Packt's online digital book library. Here, you can search, access, and
read Packt's entire library of books.

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.

Chapter 2, Network Addressing, explains how nodes on a network


use addresses. How Java represents these addresses is introduced
along with support for IPv4 and IPv6. This chapter also covers how
Java can configure various network properties.

Chapter 3, NIO Support for Networking, explains how the NIO


package provides support for communication using buffers and
channels. These techniques are illustrated with a client/server
application. The support that NIO provides for asynchronous
communication is also demonstrated.

Chapter 4, Client/Server Development, covers how HTTP is an


important and widely-used protocol. Java provides support for this
protocol in a variety of ways. These techniques are illustrated along
with a demonstration of how cookies are handled in Java.

Chapter 5, Peer-to-Peer Networks, discusses how peer-to-peer


networks provide a flexible alternative to the traditional client/server
architecture. The basic peer-to-peer concepts are introduced along
with demonstrations of how Java supports this architecture.
FreePastry is used to illustrate one open source peer-to-peer solution
framework.

Chapter 6, UDP and Multicasting, explains how UDP is an alternative


to TCP. It provides a less reliable but more efficient way for
applications to communicate across the Internet. Java's extensive
support for this protocol is demonstrated, including NIO support, and
how UDP can support streaming media.
Chapter 7, Network Scalability, explains how, as more demands are
placed on a server, systems need to scale to address these demands.
Several threading techniques supporting this need are demonstrated,
including thread pools, futures, and the NIO's selector.

Chapter 8, Network Security, discusses how applications need to


protect against a variety of threats. This is supported in Java using
encryption and secure hashing techniques. Symmetric and
asymmetric encryption techniques are illustrated. In addition, the
use of TLS/SSL is demonstrated.

Chapter 9, Network Interoperability, covers how Java applications


may need to exchange information with other applications that are
written in different languages. The issues that impact an
application's interoperability are examined, including byte order.
Communication between different implementations is demonstrated
using sockets and middleware.
What you need for this book
Java SDK 1.8 is needed for the network programming examples that
are encountered in the book. An IDE, such as NetBeans or Eclipse, is
recommended. NetBeans IDE 8.0.2 EE edition is used to illustrate
the development of a web service.
Who this book is for
This book is for developers who are already proficient in Java and
want to learn how to develop network-enabled Java applications.
Familiarity with basic Java and object-oriented programming
concepts is all that is needed. You will learn the basics of network
programming and how to use a multitude of different sockets to
create secure and scalable applications.
Conventions
In this book, you will find a number of text styles that distinguish
between different kinds of information. Here are some examples of
these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames,


file extensions, pathnames, dummy URLs, user input, and Twitter
handles are shown as follows: "The SSLSocketFactory class'
getDefault returns an SSLSocketFactory instance whose
createSocket creates a socket that is connected to the secure echo
server."

A block of code is set as follows:

public class ThreadedEchoServer implements


Runnable {
private static Socket clientSocket;

public ThreadedEchoServer(Socket clientSocket)


{
this.clientSocket = clientSocket;
}
...
}

Any command-line input or output is written as follows:

Enter keystore password:


Re-enter new password:
What is your first and last name?
[Unknown]: First Last
What is the name of your organizational unit?
[Unknown]: packt
What is the name of your organization?
[Unknown]: publishing
What is the name of your City or Locality?
[Unknown]: home
What is the name of your State or Province?
[Unknown]: calm
What is the two-letter country code for this unit?
[Unknown]: me
Is CN=First Last, OU=packt, O=publishing, L=home,
ST=calm, C=me correct?
[no]: y

Enter key password for <mykey>


(RETURN if same as keystore password):

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.

To send us general feedback, simply e-mail


<feedback@packtpub.com>, and mention the book's title in the subject
of your message.

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.

Downloading the example code


You can download the example code files from your account at
http://www.packtpub.com for all the Packt Publishing books you
have purchased. 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.

Downloading the color images of


this book
We also provide you with a PDF file that has color images of the
screenshots/diagrams used in this book. The color images will help
you better understand the changes in the output. You can download
this file from:
https://www.packtpub.com/sites/default/files/downloads/LearningNe
tworkProgrammingwithJava_Graphics.pdf.

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.

To view the previously submitted errata, go to


https://www.packtpub.com/books/content/support and enter the
name of the book in the search field. The required information will
appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem
across all media. At Packt, we take the protection of our copyright
and licenses very seriously. If you come across any illegal copies of
our works in any form on the Internet, please provide us with the
location address or website name immediately so that we can
pursue a remedy.

Please contact us at <copyright@packtpub.com> with a link to the


suspected pirated material.

We appreciate your help in protecting our authors and our ability to


bring you valuable content.

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.

In this chapter, we will cover the basics of Network programming:

Why networking is important


The support that Java provides
Simple programs to address basic network operations
Basic networking terminology
A simple server/client application
Using a thread to support a server

Throughout this book, you will be exposed to many network


concepts, ideas, patterns, and implementation strategies using both
older and newer Java technologies. Network connections occur at a
low level using sockets, and at a much higher level using a multitude
of protocols. Communications can be synchronous requiring careful
coordination of requests and responses, or they can be
asynchronous where other activities are performed until the
response has been submitted.
These and other concepts are addressed through a series of
chapters, each focusing on a specific topic. The chapters
complement each other by elaborating on concepts that were
previously introduced, whenever possible. Numerous code examples
are used whenever possible to further your understanding of the
topic.

Central to accessing a service is knowing or discovering its address.


This address may be human readable, such as www.packtpub.com,
or in the form of an IP address such as 83.166.169.231. Internet
Protocol (IP) is a low-level addressing scheme that is used to
access information on the Internet. Addressing has long used IPv4
to access resources. However, these addresses are all but gone. The
newer IPv6 is available to provide a larger range of addresses. The
basics of network addressing and how they can be managed in Java
is the focus of Chapter 2, Network Addressing.

The intent of network communication is to transfer information to


and from other applications. This is facilitated using buffers and
channels. Buffers hold information temporarily until it can be
processed by an application. Channels are an abstraction that
simplifies communications between applications. The NIO and NIO.2
packages provide much of the support for buffers and channels. We
will explore these techniques along with other techniques, such as
blocking and non-blocking IO, in Chapter 3, NIO Support for
Networking.

Services are provided by servers. An example of this is the simple


echo server, which retransmits what it was sent. More sophisticated
servers, such as HTTP servers, can support extensive services to
meet a wide range of needs. The client/server model and its Java
support are covered in Chapter 3, NIO Support for Networking.

Another service model is the peer-to-peer (P2P) model. In this


architecture, there is no central server, but rather a network of
applications that communicate to provide a service. This model is
represented by applications, such as BitTorrent, Skype, and BBC's
iPlayer. While much of the support that is required for the
development of these types of applications is beyond the scope of
this book, Chapter 4, Client/Server Development, explores P2P
issues and the support provided by Java and JXTA.

IP is used at a low level to send and receive packets of information


across a network. We will also demonstrate the use of User
Datagram Protocol (UDP) and Transmission Control Protocol
(TCP) communication protocols. These protocols are layered on top
of IP. UDP is used to broadcast short packets or messages with no
guarantee of reliable delivery. TCP is used more commonly and
provides a higher level of service than that of UDP. We will cover the
use of these related technologies in Chapter 5, Peer-to-Peer
Networks.

A service will often be faced with varying levels of demand placed on


it due to a number of factors. Its load may vary by the time of the
day. As it becomes more popular, its overall demand will also
increase. The server will need to scale to meet increases and
decreases in its load. Threads and thread pools have been used to
support this effort. These and other technologies are the focus of
Chapter 6, UDP and Multicasting.

Increasingly, applications need to be secure against attacks by


hackers. When it is connected to a network, this threat increases. In
Chapter 7, Network Scalability, we will explore many of the
techniques available to support secure Java applications. Among
these is the Secure Socket Level (SSL), and how Java supports it.

Applications rarely work in isolation. Hence, they need to use


networks to access other applications. However, not all applications
are written in Java. Networking with these applications can pose
special problems ranging from how the bytes of a data type are
organized to the interface supported by the application. It is
common to work with specialized protocols, such as HTTP, and
WSDL. The last chapter of this book examines these issues from a
Java perspective.

We will demonstrate both older and newer Java technologies.


Understanding the older technologies may be necessary in order to
maintain older code, and it can provide insight into why the newer
technologies were developed. We will also complement our examples
using many of the Java 8 functional programming techniques. Using
Java 8 examples along with pre-Java 8 implementations, we can
learn how to use Java 8 and be better informed as to when it can
and should be used.

It is not the intent to fully explain the newer Java 8 technologies,


such as lambda expressions, and streams. However, the use of Java
8 examples will provide an insight into how they can be used to
support networked applications.

The remainder of this chapter touches on many of the network


technologies that are explored in this book. You will be introduced to
the basics of these techniques, and you should find them easy to
understand. However, there are a few places where time does not
permit us to fully explore and explain these concepts. These issues
will be addressed in subsequent chapters. So, let's begin our
exploration with network addressing.

Network addressing using the


InetAddress class
An IP address is represented by the InetAddress class. Addresses
can be either unicast where it identifies a specific address, or it can
be multicast, where a message is sent to more than one address.

The InetAddress class has no public constructors. To get an


instance, use one of the several static get type methods. For
example, the getByName method takes a string representing the
address as shown next. The string in this case is a Uniform
Resource Locator (URL):

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.

This will display the following results:

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.

If we need other information about the address, we can use one of


several methods, as illustrated here:

System.out.println("CanonicalHostName: "
+ address.getCanonicalHostName());
System.out.println("HostAddress: " +
address.getHostAddress());
System.out.println("HostName: " +
address.getHostName());

This produces the following output when executed:


CanonicalHostName: 83.166.169.231

HostAddress: 83.166.169.231

HostName: www.packtpub.com

To test to see whether this address is reachable, use the isReachable


method as shown next. Its argument specifies how long to wait
before deciding that the address cannot be reached. The argument
is the number of milliseconds to wait:

address.isReachable(10000);

There are also the Inet4Address and Inet6Address classes that


support IPv4 and IPv6 addresses, respectively. We will explain their
use in Chapter 2, Network Addressing.

Once we have obtained an address, we can use it to support


network access, such as with servers. Before we demonstrate its use
in this context, let's examine how we can obtain and process data
from a connection.
NIO support
The java.io, java.nio, and java.nio subpackages provide most of
the Java support for IO processing. We will examine the support that
these packages provide for network access in Chapter 3, NIO
Support for Networking. Here, we will focus on the basic aspects of
the java.nio package.

There are three key concepts used in the NIO package:

Channel: This represents a stream of data between


applications
Buffer: This works with a channel to process data
Selector: This is a technology that allows a single thread to
handle multiple channels

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 four primary channels:

FileChannel:This works with a file


DatagramChannel: This supports UDP communications
SocketChannel: This is used with a TCP client
ServerSocketChannel: This is used with a TCP server

There are several buffer classes that support primitive data types,
such as character, integer, and float.

Using the URLConnection class


A simple way of accessing a server is to use the URLConnection class.
This class represents a connection between an application and a URL
instance. A URL instance represents a resource on the Internet.

In the next example, a URL instance is created for the Google


website. Using the URL class' openConnection method, a
URLConnection instance is created. A BufferedReader instance is used
to read lines from the connection that is then displayed:

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:

<!doctype html><html itemscope=""


itemtype="http://schema.org/WebPage" ...

The URLConnection class hides some of the complexity of accessing


HTTP servers.
Using the URLConnection class with
buffers and channels
We can rework the previous example to illustrate the use of channels
and buffers. The URLConnection instance is created as before. We
will create a ReadableByteChannel instance and then a ByteBuffer
instance, as illustrated in the next example. The
ReadableByteChannel instance allows us to read from the site using
its read method. A ByteBuffer instance receives data from the
channel and is used as the argument of the read method. The buffer
created holds 64 bytes at a time.

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

The Channel class and its derived classes provide an improved


technique to access data found on a network than data provided by
older technologies. We will be seeing more of this class.
The client/server architecture
There are several ways of creating servers using Java. We will
illustrate a couple of simple approaches and postpone a detailed
discussion of these techniques until Chapter 4, Client/Server
Development. Both a client and a server will be created.

A server is installed on a machine with an IP address. It is possible


for more than one server to be running on a machine at any given
time. When the operating system receives a request for a service on
a machine, it will also receive a port number. The port number will
identify the server to where the request should be forwarded. A
server is, thus, identified by its combination of IP address and port
number.

Typically, a client will issue a request to a server. The server will


receive the request and send back a response. The nature of the
request/response and the protocol used for communication is
dependent on the client/server. Sometimes a well-documented
protocol, such as the Hypertext Transfer Protocol (HTTP), is
used. For simpler architectures, a series of text messages are sent
back and forth.

For the server to communicate with an application making a request,


specialized software is used to send and receive messages. This
software is called a socket. One socket is found on the client side,
and the other socket is located on the server side. When they
connect, communication is possible. There are several different types
of sockets. These include datagram sockets; stream sockets, which
frequently use TCP; and raw sockets, which normally work at the IP
level. We will focus on TCP sockets for our client/server application.

Specifically, we will create a simple echo server. This server will


receive a text message from a client and will immediately send it
back to that client. The simplicity of this server allows us to focus on
the client-server basics.
Creating a simple echo server
We will start with the definition of the SimpleEchoServer class as
shown next. In the main method, an initial server message will be
displayed:

public class SimpleEchoServer {


public static void main(String[] args) {
System.out.println("Simple Echo Server");
...
}
}

The remainder of the method's body consists of a series of try blocks


to handle exceptions. In the first try block, a ServerSocket instance
is created using 6000 as its parameter. The ServerSocket class is a
specialized socket that is used by a server to listen for client
requests. Its argument is its port number. The IP of the machine on
which the server is located is not necessarily of interest to the server,
but the client will ultimately need to know this IP address.

In the next code sequence, an instance of the ServerSocket class is


created and its accept method is called. The ServerSocket will block
this call until it receives a request from a client. Blocking means that
the program is suspended until the method returns. When a request
is received, the accept method will return a Socket class instance,
which represents the connection between that client and the server.
They can now send and receive messages:

try (ServerSocket serverSocket = new


ServerSocket(6000)){
System.out.println("Waiting for
connection.....");
Socket clientSocket =
serverSocket.accept();
System.out.println("Connected to client");
...
} catch (IOException ex) {
// Handle exceptions
}

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:

try (BufferedReader br = new BufferedReader(


new InputStreamReader(
clientSocket.getInputStream()));
PrintWriter out = new PrintWriter(
clientSocket.getOutputStream(),
true)) {
...
}
}

The second argument to the PrintWriter constructor is set to true.


This means that text sent using the out object will automatically be
flushed after each use.

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);
}

Before we demonstrate the server in action, we need to create a


client application to use with it.

Creating a simple echo client


We start with the declaration of a SimpleEchoClient class where in
the main method, a message is displayed indicating the application's
start that is shown as follows:

public class SimpleEchoClient {


public static void main(String args[]) {
System.out.println("Simple Echo Client");
...
}
}

A Socket instance needs to be created to connect to the server. In


the following example, it is assumed that the server and the client
are running on the same machine. The InetAddress class' static
getLocalHost method returns this address, which is then used in the
Socket class's constructor along with port 6000. If they are located
on different machines, then the server's address needs to be used
instead. As with the server, an instance of the PrintWriter and
BufferedReader classes are created to allow text to be sent to and
from the server:

try {
System.out.println("Waiting for
connection.....");
InetAddress localAddress =
InetAddress.getLocalHost();

try (Socket clientSocket = new


Socket(localAddress, 6000);
PrintWriter out = new
PrintWriter(
clientSocket.getOutputStream(), true);
BufferedReader br = new
BufferedReader(
new InputStreamReader(

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);
}

These programs can be implemented as two separate projects or


within a single project. Either way, start the server first and then
start the client. When the server starts, you will see the following
displayed:

Simple Echo Server

Waiting for connection.....

When the client starts, you will see the following:

Simple Echo Client

Waiting for connection.....

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:

Enter text: Hello server

Server response: Hello server

Enter text: Echo this!

Server response: Echo this!

Enter text: quit

The server's output is shown here after the client has entered the
quit command:

Simple Echo Server

Waiting for connection.....


Connected to client

Client request: Hello server

Client request: Echo this!

This is one approach to implement the client and server. We will


enhance this implementation in later chapters.
Using Java 8 to support the echo
server and client
We will be providing examples of using many of the newer Java 8
features throughout this book. Here, we will show you alternative
implementations of the previous echo server and client applications.

The server uses a while loop to process a client's request as


duplicated here:

String inputLine;
while ((inputLine = br.readLine()) != null) {
System.out.println("Client request: " +
inputLine);
out.println(inputLine);
}

We can use the Supplier interface in conjunction with a Stream


object to perform the same operation. The next statement uses a
lambda expression to return a string from the client:

Supplier<String> socketInput = () -> {


try {
return br.readLine();
} catch (IOException ex) {
return null;
}
};
Other documents randomly have
different content
Aria, Madame Pasta, ‘Bel
raggio.’ (Semiramide.) ROSSINI.
Duetto, violoncello e
contra basso, Messrs.
Lindley and Dragonetti. CORELLI.
Aria, Madame Puzzi, ‘Se
amore soltanto.’ Corno, MAYER AND
obligato Signor Puzzi. ROSSINI.
Overture. (Anacreon.) CHERUBINI.
Leader, Mr. Mori.—Conductor, Mr. C.
Potter.

Beethoven’s first symphony was that in C, which at once, without


the usual gradatim rise, placed him on a level with Haydn and
Mozart. It is now nearly forty years since it was written, but, owing
to the state of the continent, did not reach this country till about
fifteen years after its appearance at Vienna, and was then only
attempted by bold instrumentalists. This Society, however, from its
very commencement took it up,—it was the first symphony ever
performed by the Philharmonic band, and then was heard
everywhere in some shape or other; till at length—such is the fate of
all that is good in music—by too frequent repetition, it began to ‘pall
upon the sense,’ and was laid aside. It now came out, after many
years’ repose, in much of its pristine freshness,—it was actually new
to some of the audience, and was welcomed by all.
Mr. Potter’s symphony is not only the best composition that has
yet proceeded from his pen, but a work that will give him an
honourable place in the temple of fame,—a work, that the oftener it
is heard the better it will be understood, and the more it will be
liked; for not only the experienced master, but the man of genius, is
evinced in every movement. It consists of an allegro con fuoco, in G
minor, strikingly original; a very melodious and effective andante in D
minor; a bold scherzo in G minor, and trio in E flat; and a finale in G
minor. The only point in this symphony that seems to us liable to
objection, is, that all the movements, except a short trio, are in the
minor key, and this three times the same; thus a want of contrast is
felt at the beginning and ending of each, though in the modulations
the major third is sufficiently often introduced to afford the
necessary relief.
The Fantasia Drammatica, for the full orchestra, is a descriptive
piece; but M. Neukomm has had the good sense to attempt only to
describe generally, never particularly. The last four books of Paradise
Lost have supplied him with subjects, as his printed argument will
show. The numbers distinguish the movements:—
No. 1. Adam’s and Eve’s happiness in Paradise.—Their
Morning Hymn.—(Books IX. and X.)
No. 2. Adam and Eve go forth to their labours.—Temptation.—
Transgression.—Satan’s Triumph.—(Books IX. and X.)
No. 3. Judgment of the transgressors.—Book X.
No. 4. Their lamentation.—Only consolation in the promise of
the coming Redeemer.[69]—Submission.—Michael leads
them out of Paradise.—(Books XI. and XII.)
The phrase alluded to by the composer is the first few bars of ‘I
know that my Redeemer liveth,’ which he has introduced in a most
felicitous manner. That the whole of this is well written, we hardly
need say. There is some imagination in the various movements, but
not of that vigorous kind which will put the indelible stamp of genius
on the work.
M. Hummel’s concerto—the same that he produced at his recent
benefit—is a very masterly composition, and, with a far superior
band, went off much better now than at his own concert. The duet
between Lindley and Dragonetti fixed the attention of the whole
room, and pleased all. The last movement was loudly encored, for
the wonderful command obtained over so intractable an instrument
as the double-base naturally enough excites a desire to witness
more of it than the single hearing of so brief a piece affords an
opportunity of doing. The soft, low tones also, after the brass band
had been very active, operated as a great relief to the auricular
nerves.
Though the vocal portion of this concert furnished nothing new,
the manner in which it was executed by Madame Pasta and Signor
Tamburini gave a charm to it that was most sensibly felt by all
present, who testified their pleasure by the warmest applause; and
applause is not here lavishly or indiscriminately bestowed.
Madame Puzzi and her smaller half took more pains with the aria
of Rossini than, as a composition, it deserved, but not more than
that respect which they always feel for their audience taught them
was required.

EIGHTH CONCERT, MONDAY, JUNE 10, 1833.


ACT I.
Sinfonia, No. 4. BEETHOVEN.
Aria, Signor Zuchelli,
‘Mentre ti lascio.’ MOZART.
Concerto, piano-forte,
M. Herz. HERZ.
Scena, Madame
Malibran, ‘Non più di
fiori.’ Corno di
bassetto obligato, M.
Willman. MOZART.
Overture, composed
expressly for the
Philharmonic Society,
and first time of F. MENDELSSOHN
performance. BARTHOLDY.
ACT II.
Sinfonia in G minor. MOZART.
Aria, Madame Cinti
Damoreau, ‘Sento un
interna voce,’ (Elisabetta.) ROSSINI.
First Concerto Violin, M.
De Beriot. DE BERIOT.
Duetto, Madame Cinti
Damoreau and Madame
Malibran, ‘Vanne, se
alberghi in petto.’
(Andronico.) MERCADANTE.
Overture. (Egmont.) BEETHOVEN.
Leader, Mr. Weichsel.—Conductor, Mr.
Bishop.

The symphony in B flat of Beethoven, though less known than


two or three of his others, is inferior to none in beauty, and in that
kind of originality which does not strike the hearer who is content to
enjoy without inquiring into the remoter causes of his pleasure. Both
this and Mozart’s in G minor, which it is needless to praise, were
performed and received with a warmth of feeling that acts by
reciprocation, and is a cause, a main one, of the acknowledged, the
vast superiority of the instrumental performances at these concerts.
The overture by M. Mendelssohn in C, declares itself the offspring of
genius and knowledge. Its rapidity and, what appears, wildness,
render an analysis of it impossible, without either frequent hearing
or an examination of the work on paper; we therefore venture no
further opinion of it than the very general one we now express.
Great curiosity was excited to hear M. Herz, whose name has for
some time past been pretty well known in all the music-shops of
Europe. To those who consider mechanical dexterity, or that sort of
command of the key-board which persevering labour is sure to
bestow, the perfection of piano-forte playing,—or, in other words, to
such as think what is termed execution the only reasonable aim and
desirable end of music,—this gentleman must appear the realization
of the beau-ideal of a performer: the neatness with which, without
any apparent effort, he does extraordinary feats, is surprising—quite
as astonishing as some things accomplished by Paganini on the
violin, and equally valuable, in the eyes of those who ground their
judgment on anything like sound principle. He crosses his hands, he
weaves his fingers, with the cleverness of a juggler; an automaton
constructed by Maelzel could hardly surpass him in precision. He
invents and masters passages which the greatest musicians never
dreamt of, which the best players never did and never will attempt,
and is a most successful rival of that self-playing piano-forte which is
manufactured and to be purchased somewhere in London within
sound of Bow-bell. But with those who think that sentiment or
expression,—that taste, that rich harmony, that air ‘che nell’ anima si
sente,’ are all or any of them essential to good music, M. Herz has
small chance of becoming a favourite. To which party the majority of
our readers belong, we only know by conjecture: we lay the case
before them in the best way that our ability will permit, and
respectfully leave them to guess our opinion. The concerto
performed by M. Herz is in C minor, and at least on a par with most
of the other compositions by the same author.
M. de Beriot’s concerto, though not as a composition equal to
that he played on the sixth night, proved highly gratifying to his
audience, for his performance was marked by excellencies in which
he has no rival. He was greeted with acclamations.
Not less animated were the applauses that followed the scena of
Mozart, ‘Ecco il punto,’ and aria, ‘Non più di fiori,’ in which Madame
Malibran displayed a compass of voice, (from A below to A above the
treble staff,) a power in delivering this fine recitative, and a
correctness of taste in the execution of the air, that, altogether, we
never knew equalled. In the duet, which is one of the best things
that Mercadante has produced, the two ladies were quite equal in
their respective styles, and established a just right to the almost
enthusiastic approbation they met with. The aria sung by Signor
Zuchelli, a clever composition, is among the Operngesaenge of
Mozart, but he was not at home in it: probably he had not had time
enough to study it sufficiently. He was nearly overpowered, too, by
an unmercifully loud accompaniment, a fault, and a very glaring one,
in these concerts, which the directors ought to have corrected. Most
of the audience stayed to hear the profound overture to Egmont,
which terminated a remarkably fine and universally admired concert.
BENEFIT CONCERTS OF THE
SEASON.
MR. VAUGHAN’s,
Hanover Square Rooms, Friday Evening, April 26.

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.

M. Moscheles gave the septetto written for the Philharmonic


Society, with exceedingly good effect. He also, with M. Mendelssohn,
played Weber’s Gipsies’ March with concertante variations, as a duet
for two piano-fortes, which excited the most lively interest—these
two highly distinguished musicians having each contributed his share
of variations, and, in friendly conflict, put forth all their powers in the
performance of them. Their cadences were of the most masterly
kind, and excited the admiration of a crowded room, in which were
most of the connoisseurs in town. Miss Francilla Pixis made her first
appearance in London, in a feeble air by Bellini. Her voice is a mezzo
soprano, and as she had but recently recovered from an
indisposition, her performance is hardly a fair subject for criticism.
Mad. Pircher sang an air from Figaro, in German, not in the best
manner. Indeed it was injudicious to give it in a translation. But the
strength of the concert consisted in the instrumental part; this also
included Mendelssohn’s fine poetical overture to A Midsummer
Night’s Dream, and a clever extemporaneous performance by M.
MOSCHELES.

M. PIO CIANCHETTINI’s AND MAD. CAMPANILE’s,


At Willis’s Rooms, Monday Morning, May 6.

M. Cianchettini produced a new duet for piano-forte and flute, in


which he was ably supported by M. Sedlatzek. He also performed
Dussek’s fine duet for two piano-fortes, with his sister, Mad.
Campanile; likewise an extempore fantasia. Mad. Cinti, Signori
Rubini, Donzelli, Zuchelli, &c., rendered their vocal assistance; and
M. Mori, M. Puzzi, M. Sedlatzek, and M. Sagrini, on the violin, horn,
flute, and guitar, contributed their assistance.

MRS. ANDERSON’s,
Opera Concert Room, Friday Morning, May 10.

Mrs. Anderson introduced, for the first time in public, Beethoven’s


concerto in G, which she performed in her accustomed accurate and
brilliant manner. Also the fantasia of the same composer, in which he
has joined voices and instruments. She likewise played Czerny’s
Military Fantasia, which, having the least merit of the three pieces,
was most applauded, for the assembly—a remarkably full one, as
usual—was of a very fashionable kind. Mad. Pasta sang (for the
hundredth time, we believe) ‘Il braccio mio conquise;’ and the best
thing Morlacchi ever produced, ‘Notte tremenda.’ Mad. Cinti gave
‘The last Rose of Summer’ with variations. The latter were executed
in a most perfect manner, and the absurdity of them did not seem to
strike the audience. She also sang an unmeaning air by Pucitta, but
made up for the weakness of this by accompanying herself very
skilfully on the piano-forte. Mori played a violin solo by Mayseder, in
which was less of that skittishness than is commonly found in the
productions of this ephemeral composer. And Miss A. Windsor
performed a harp concerto by Labarre, with considerable applause.

M. HUMMEL’s,
Opera Concert Room, Monday Morning, May 13.

The most attractive piece in this performance was a new


concerto by M. Hummel, a composition in which knowledge and
taste are equally and happily combined. He also played a new Rondo
Brillante, the subjects and style of which are quite of the popular
kind, though, of course, it can only be made available, should it be
published, by a few—by those who devote their lives to the
overcoming of difficulties. Mesdames Pasta, De Meric, and Pircher,
Signori Donzelli and Tamburini, with Herr Blume and Herr Binder,
sang each one aria. The German vocalists also attended, and
performed what we should be inclined to call an English glee, to
German words, and not a very good one. In fact, had they not been
foreign, and had not the music been throughout the same, nothing
but the urbanity of the audience would have prevented their
manifesting some disapprobation at such a performance. The room
was not fully attended.

MR. F. CRAMER’s,
At the Hanover Square Rooms, Wednesday, May 15.

To the regret of his numerous friends, Mr. F. Cramer was by


indisposition prevented from being present at his own concert, but
his place was ably filled by Mr. Mori; and his brother, Mr. J. B.
Cramer, delighted the Audience by a concertino, a pasticcio in fact,
made up for the occasion, on the piano-forte. Mr. F. Cramer’s pupil,
young Blagrove, played Mayseder’s concerto in E minor with great
neatness and spirit; and Mr. Wright exhibited much talent in
Hummel’s favourite concerto, adapted for the harp; a change,
however, which we cannot quite approve, and trust that it will not
often be imitated. Mrs. Knyvett sang ‘If guiltless blood,’ very
feelingly. Mr. Phillips was very great in Neukomm’s cantata,
Napoleon’s Midnight Review, and very amusing in ‘The Old English
Gentleman.’ Mad. Pasta sang ‘Ah! come rapida!’ admirably: but why
will she not extend her catalogue of arie? She doubtless has heard
of ‘toujours perdrix.’

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.

MR. DRESSLER’s AND MR. F. PELZER’s,


Opera Concert Room, Wednesday Morning, May 15.

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.

The first movement of Moscheles’ concerto, No. 5, a concerto by


Mendelssohn, and the piano-forte part of a trio by Hummel, were
played with much brilliancy by M. Kiallmark. M. Dressler performed a
flute solo. The concert was otherwise chiefly vocal; and except what
was assigned to Mad. Cinti, was far from laudable. A song, in the
programme, named ‘The Rhine,’ is too palpable an imitation of
Neukomm’s ‘Sea,’ to pass without a stricture; and as if it had been
intended to expose the author of it, the model was subsequently
produced.

M. MORI’s,
Opera Concert Room, Friday Evening, May 17.

The whole force of the London orchestra, and the corps de


l’opera, were, as usual, assembled by M. Mori, and his room was
filled in every part. He played with great force and execution a
concertino, made up of Mayseder and Maurer, and some ‘grand
variations’ by the former composer; besides the violin part of an
ottetto by Spohr, in which Handel’s celebrated air in E is introduced,
a work which certainly will not add to the fame of M. Spohr. In
addition to the above were, Mrs. Knyvett, Mrs. Bishop, Mad.
Devrient, and Miss C. Novello. MM. Moscheles and Mendelssohn
repeated the duet which they had played at the concert of the
former, and M. Bochsa played some variations on the harp. The
concert opened with Beethoven’s symphony in C minor, which was
very well executed.

M. CIPRIANI POTTER’s,
Opera Concert Room, Friday Morning, May 24.

On this occasion M. Potter produced a new symphony, a new


piano-forte concerto, and some brilliant variations on a French
theme, all of which well sustained the high reputation he has
acquired, both here and in Germany, as an instrumental composer.
We regret that our limits do not admit of our entering fully into the
merits of these fresh proofs of his ability. Mesdames Pasta and
Devrient, Signori Donzelli, Tamburini, &c., were his vocal supporters;
and his band consisted of nearly all the performers of the
Philharmonic Concerts.

M. HENRI HERZ’s,
Opera Concert Room, Wednesday Morning, May 29.

This was M. Herz’s first public appearance in England, and as his


fame had preceded his arrival among us, a large audience
assembled to hear an artist concerning whom so much diversity of
opinion prevailed. As we have spoken of him in another part of our
number we shall merely state here that he was received in a most
encouraging manner, and that his performances were followed by
very flattering applause. He played a concerto in C minor, ‘grand
variations’ on the march in Otello, and a duet on one piano-forte,
with M. Moscheles. His extemporaneous performance need hardly be
noticed. It was as good, and made up of pretty much the same
materials, as such things generally are. And we will take this
opportunity of observing, that such exhibitions are, in our opinion, as
derogatory to a great musician, as improvisation would be to a great
poet. The vocal strength consisted of Mad. Cinti, Signori Rubini and
Tamburini. Signor Puzzi played in a charming manner a fantasia on
the horn, and M. de Beriot performed a solo admirably on the violin.

MR. SALAMAN’s,
Hanover Square Rooms, Thursday Evening, May 30.

This gentleman announces himself as a pupil of Mr. Neate, to


whom he does credit. On this occasion he played Mendelssohn’s fine
concerto in G minor, and Czerny’s ‘Grand Military Fantasia,’ in a
manner that gained him much applause. Mesdames Pasta, Devrient,
De Meric, Puzzi, Mrs. Bishop, MM. Phillips, Donzelli, Haitzinger,
Zuchelli, &c., were the vocalists; and M. Eliason played a pleasing
fantasia, à l’Espagnol, on the violin. The King’s Theatre having been
open this evening, Mr. Salaman was incapable of forming a very
good orchestra, and Beethoven’s symphony in C minor suffered in
consequence. A trio à la Tyrolienne was sung by Mad. de Meric and
two debutantes, the Demoiselles Correldi, who accompanied
themselves with the castagnettes! Neither the music nor the
performance proved very satisfactory. The room was exceedingly
full, but we doubt whether it was equally productive.

MR. SALE’s,
Hanover Square Rooms, Friday Morning, May 31.

A very charming selection, in which some excellent music was


allotted to our best English singers, and equally good Italian music
was assigned to Italians. This is just as it should be, and proves Mr.
Sale’s discrimination. A new and clever madrigal by Lord Burghersh
was performed for the first time; as was a pleasing song by Mr.
Phillips. Mrs. Knyvett in ‘Let the bright seraphim,’ accompanied by
Harper, was most deservedly applauded; but we wish that she would
not add any cadenza to what is an aria d’agilità from beginning to
end. Miss Stephens in ‘John Anderson,’ and Mr. Braham ‘In native
worth,’ from the Creation, (sung by command) drew abundance of
plaudits; as did Mad. Pasta in (the old story) ‘Ah! come rapida,’ and
Mad. Cinti in Hasse’s fine bravura, ‘Sorprendermi vorresti.’ Sig. Rubini
sang, or rather sacrificed, Mozart’s ‘Il mio tesoro intanto;’ and the
Adelaida of Beethoven is too much for the physical powers of Mr.
Hobbs. The concert opened with ‘God save the King,’ in compliment
to the Duchess of Kent and the Princess Victoria, who, with their
suite, were present in the royal box, and seemed highly delighted
with the performance.

SIG. GIUBILEI’s AND L. SAGRINI’s,


At the residence of Sir John De Beauvoir, Connaught Place, Monday
Morning, June 3.

All the strength of the Italian Opera were here, augmented by


Mrs. Bishop, Miss H. Cawse, Messrs. Haitzinger and Parry, jun., &c.
Mrs. Anderson, Mr. Mori, and Sig. Costa, as instrumentalists. The
performance was well attended, and deserved the applause it
received.

MESSRS. CHELARD’s AND ELIASON’s,


Hanover Square Rooms, Friday Morning, June 7.

This opened with the overture by M. Chelard performed at the


third Philharmonic Concert, whose drinking chorus in Macbeth was
also given effectively by the German party. Mr. Eliason played a violin
concerto, the music by Rode and Mayseder, with much brilliancy of
execution, and the violin part of a duet concertante with the harp.
M. Herz played his ‘variations de concert’ on a subject from
Guillaume Tell.

M. SEDLATZEK’s,
At the residence of J. Taylor, Esq., George Street, Hanover Square,
Saturday Morning, June 8.

Well attended, and M. Sedlatzek performed several pieces on the


flute with that ease of execution and delicacy of manner for which
he is distinguished.

Mr. J. B. CRAMER’s,
Opera Concert Room, Friday Morning, June 14.

The highest treat in this concert was Mr. Cramer’s performance of


his own beautiful concerto, op. 48, which he played with that pathos
in which he excels all pianists, and with the spirit—but spirit devoid
of feats of agility—that he ever possessed. With M. Hummel he
performed the fantasia in F minor of Mozart, and, as a last
movement, the finale to his duet in F major,—a most finished
performance; and with M. Herz, a ‘grand concerto duet,’ which,
though admirably executed, we could not but think a very
incongruous union. He also introduced, by permission of the
Philharmonic Society, the new quintet he wrote for their concerts,
and which now went off in a very perfect manner. Messrs. Mori,
Nicholson, and Wright, played fantasias on their respective
instruments; and Mad. Cinti, Mrs. Knyvett, Miss Novello, Messrs.
Phillips and Parry, jun. contributed their vocal aid. The room was full
from the commencement.

SIG. AND MAD. PUZZI’s,


At the residence of the Countess Cornwallis, Friday Evening, June
14.

The élite of the foreign artistes now in London came in support


of this concert, and the company consisted almost exclusively of
people of fashion. The music exhibited little that is new, but it was
well performed, and chiefly vocal. Mad. Puzzi sang an aria, ‘Se
amore soltanto,’ by Rossini, and was charmingly accompanied by Sig.
Puzzi. The latter also played a fantasia on the horn. Messrs.
Moscheles and Herz performed a duet on the piano-forte; and
Messrs. Osborne and De Beriot a divertimento for piano-forte and
violin. The tickets to this were a guinea each, and the rooms were
well filled, but not crowded.
FOREIGN MUSICAL REPORT.
VIENNA.
A SECOND concert has been given at the Hofoperntheater by Bernhard
Romberg, which was in every respect equal to the first. The young
prodigy, Apollinar Kontsky, aged seven years, has also given a
concert; this precocious virtuoso, who still plays upon a small-sized
violin, evinced extraordinary strength of arm and perfect fulness of
tone, and particularly delighted his audience by the correct taste he
displayed, and by the expression which he infused into his
performances. With the genius which is already apparent in him, and
the promise which his present astonishing proficiency holds out, if he
persevere in the cultivation of his instrument, under the care of a
really good master, there is reason to expect that he will become
one of the first violin players in the world.

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].

DRURY LANE THEATRE.

ON the 4th of June a nondescript piece, called The Students of Jena,


or The Family Concert, was produced here, the principal character by
Madame MALIBRAN but it was a decided failure, and the theatre was
shut very shortly after.

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:—

Thy innocent smile and thy glances of love,


To mercy and pardon thy father will move:
Oh! tell him thy life has been purchased by me,
And each kind look he gave I have purchased from thee.

The Romanza is from the most admired of Mozart’s concertos.


The author has not indicated the movement, but it is commonly
played as an andante. Sig. Cimador, who arranged it, was an
excellent musician, well known in the fashionable and musical world
some thirty years, or more, since.

Purcell’s air is from an ode on the birth-day of Mary, consort of


William III. Our arrangement is made from the score published by—
Goodison, Esq., an amateur, about forty-five years ago. The beauty
of this melody speaks for itself.
The quartet, Agnus Dei, is from a mass of Beethoven and of his
sacred compositions, may fairly be deemed the most melodious and
elegant.

The Minuet and Trio from Haydn’s Eleventh Symphony, were


composed for Saloman’s Concerts about the year 1794.

The movement from Handel’s 4th Hautboy Concerto[71] is one of


his most beautiful morceaux. The melody of the latter part, marked
pianissimo, is written for the bassoon, an octave lower than it now
appears; but in arranging it for the piano-forte, we thought it
advisable to place it an octave higher, as we could not add the
hautboy accompaniment in any convenient form for the player. It
should be borne in mind that the allegro of Handel’s time was not so
quick as the allegro of the present day.
The Hautboy Concertos, six in number, were written at Cannons,
the seat of the Duke of Chandos, (Pope’s Timon,) in the year 1720,
and published in 1729. Four of them still continue to be used in the
Ancient Concerts, where they are admirably performed, and are
great favourites with the subscribers, as they deserve to be with all
lovers of good music.
AUGUST,
1833.

BIOGRAPHICAL SKETCHES OF
MARIN MERSENNE AND
ATHANASIUS KIRCHER.
[Chiefly from HAWKINS’s and BURNEY’s Histories.]

AMONG the laborious and voluminous writers on music, those now


selected stand prominently forward; and though their respective
merits are far from equal—the French ecclesiastic being undeniably
superior to the German jesuit, both in knowledge and exactness—
yet the works of each have long enjoyed a high reputation, and will
always be found useful to those who study music as a science, or
historically, and as connected with general literature.

MARIN MERSENNE (in Latin, Marinus Mersennus), a most learned


French writer, was born in 1588, at Ayse, in the province of Maine.
He received his instruction in polite literature at the college of
Flêche; but, quitting that seminary, he went to Paris, and, after
having studied divinity some years in the college of the Sorbonne,
entered himself among the Minims (a religious order), and, in 1611,
received the habit. In 1612, he went to reside in the convent of that
order at Paris, where he was ordained priest, and performed his first
mass in 1613. Immediately upon his settlement he applied himself to
the study of the Hebrew language, under the direction of Father
John Bruno, a Scotch Minim, and having acquired a competent
degree of skill therein, became a teacher of philosophy and theology
in the convent of Nevers. In this station he continued till the year
1619, when he returned to Paris, determined to spend the remainder
of his life in study and conversation, as indeed he did, making them
his whole employment. In the pursuit of his studies he established
and kept up a correspondence with all the learned and ingenious
men of his time.
During his stay at Flêche he contracted a friendship with Des
Cartes, and manifested it in many instances; of which the following
may be reckoned one. Being at Paris, and looked on as the friend of
the great philosopher, he reported that Des Cartes was erecting a
new system of physics on the foundation of a vacuum; but finding
that the public were indifferent to it, he immediately sent intelligence
to his friend that a vacuum was not then the fashion, on which the
philosopher changed his system, and adopted the old doctrine of a
plenum. The residence of Mersenne at Paris did not prevent his
making several journeys into foreign countries, for he visited Holland
in the middle of the year 1629, and Italy four times, in 1639, 1641,
1644, 1646. In the month of July, 1648, having been to call on his
friend Des Cartes, he returned home to his convent excessively
heated; to allay his thirst, he drank cold water, and soon after was
seized with an illness which produced an abscess in his side. His
physicians, imagining his disorder to be a kind of pleurisy, ordered
him to be bled several times, but to no purpose. At last it was
thought proper to open his side: the operation was begun, but he
expired in the midst of it, on the 1st of September, 1648, being then
about sixty years of age. He had desired the surgeons, in case of
miscarriage in the operation, to open his body, which direction they
complied with, and found that they had made the incision two inches
below the abscess!
The character of Mersennus as a philosopher and a
mathematician is well known in the learned world. To that
disposition which led him to the most abstruse studies, he joined a
nice and judicious ear, and a passionate love of music; these gave a
direction to his pursuits, and were productive of numberless
experiments and calculations, tending to demonstrate the principles
of harmony, and prove that it is independent of habit or fashion,
custom or caprice, and, in short, has its foundation in nature, and in
the original frame and constitution of the universe.
In the year 1636, Mersenne published, at Paris, in a large folio
volume, his Harmonie Universelle, in which he treats of the nature
and properties of sound, of instruments of various kinds, of
consonances and dissonances, of composition, of the human voice,
of the practice of singing, and a great variety of other matters
concerning music.
This work consists of a great number of separate and distinct
treatises, with such signatures for the sheets, and numbers of the
pages, as to make them independent of each other. The
consequence whereof is, that there are hardly any two copies to be
met with that contain precisely the same number of tracts, or in
which the tracts occur or follow in the same order; so that to cite or
refer to the Harmonie Universelle is a matter of some difficulty.
Among these are to be found the most minute and satisfactory
account of the state of music in France during the reign of Louis
XIII. Indeed, Dr. Burney remarks,—his Harmonie Universelle is a
work in which, notwithstanding his ‘partiality to his country, want of
taste and of method, there are so many curious researches and
ingenious and philosophical experiments, which have been of the
greatest use to subsequent writers, particularly Kircher, as render
the book extremely valuable.’ This work, corrected and enlarged,
was translated into Latin, and published by the author in 1648, the
year of his death, under the title of De Sonorum Natura, Causis et
Effectibus.
In his twenty-third proposition, liv. i., Mersenne explains and
describes twelve different kinds of music and movement used in
France during his time: namely, motets, songs or airs, passacailles,
pavans, allemandes, gaillards, voltes, courantes, sarabands,
canaries, branles, and balets; of all which he gives examples in
notes. But though most of these movements were the specific
names of the dances then in vogue, the minuet, which during the
last century was in such general favour all over Europe, is never
mentioned.
In the Préface Générale, the author speaks of Galileo’s
discoveries in harmonics; and in his liv. ii., Des Consonances, of
sympathetic vibrations. In other parts of his work he clearly explains
the twelve major keys of practical music; and shows, for the first
time perhaps, that there may be seventy-two keys, or six for each
note, flat, natural, and sharp, major and minor. There is nothing in
this good Father’s book which reflects more honour on his taste and
penetration than his partiality for the violin, to which, in liv. iv., Des
Instruments, prop. 1, he gives the preference over all other
instruments then in use, at a time when it was thought unworthy of
being admitted into the concerts of other countries.
One proposition in this book (xxxiv.) is to inquire whether the
French method of singing is the best of all possible methods? and he
determines in the affirmative, not only with respect to this, but
affirms, that of all those he ever heard sing in neighbouring
countries, as in Spain, Germany, Flanders, and Italy, he had met with
none who sang so agreeably as the French. ‘There may,’ says he, ‘be
now and then a miraculous performer in other countries, but I speak
here in general.’
He mentions recitative as a thing little practised in France, for
want of courage. The Italians, he observes, succeed in this species
of singing, which Giacomo Peri had invented at Florence at the
beginning of the century. Here he speaks of several musical dramas
in Italy, but does not call them operas. (Liv. vi. L’Art de bien
chanter.)
ATHANASIUS KIRCHER was born at Fulda in Germany, in 1601. At the
age of seventeen he entered the society of Jesuits, and, after going
through a regular course of study, during which he distinguished
himself by his vast attainments in literature and science, he became
a teacher of philosophy, mathematics, and the Hebrew and Syriac
languages, in the University of Wurtzburg in Franconia. In 1631,
when the Swedes entered Germany under Gustavus Adolphus, he
returned to France, and settled in the Jesuits’ college at Avignon,
where he remained till 1635. He was then called to Rome to teach
mathematics in the Roman college, where he continued during six
years. He afterwards became professor of Hebrew in that city, and
died there in 1680, having written and published twenty-two
volumes in folio, eleven in quarto, and three in octavo. Kircher was
more than ordinarily addicted to the study of hieroglyphics, and it is
said that certain young scholars caused to be engraved some
unmeaning fantastic characters or figures upon a shapeless stone,
then buried it in ground which was shortly to be dug up. Upon
digging the place, the stone was found, and, by the scholars who
had hidden it, carried to Kircher as a most singular antique, who,
quite in raptures, applied himself instantly to explain the characters,
and, as he perhaps persuaded himself, and certainly attempted to
persuade others, made them intelligible.
The chief work of Kircher is his Musurgia Universalis, which is
written in Latin, in ten books, occupying two volumes in folio, the
first containing seven books, the second three. The subjects on
which he treats are principally the following—of the propagation of
sound—of the elements of practical music—of harmonics, or the
ratios of sounds—geometric and algebraic division of the monochord
—new experiments in the construction of musical instruments—of
melody, comprehending new secrets for producing every species of
melody (!)—a parallel between ancient and modern music, pointing
out the dignity of the ecclesiastical canto fermo, and the means of
arriving at the pathetic style—of composition, or the combinations of
sounds, and the application of air to poetical numbers and rhythms
in all languages—musical wonders produced by hidden means, and
new experiments of all kinds—and, lastly, of the various derivations
of music, and the physical and artificial purposes to which it is, or
may be, applied.
Kircher was the inventor of the Æolian harp, which he thus
describes in his Musurgia, (lib. ix. 352.):—The instrument is not only
new, but agreeable, and very easy of construction, and every one
admires it who hears it in my museum. It is silent while the window
remains shut, but when this is opened, sudden bursts of harmony
surprise the auditor, who cannot tell whence they proceed, or by
what kind of instrument they are produced, the sounds not
resembling those of a stringed or a wind instrument, but are a
mixture of both. This instrument is made of deal, is fifteen inches
long, six broad, and three deep. It may be strung with fifteen
strings, or more, all equal, and of catgut.
This work, says Dr. Burney, speaking of the Musurgia, which
undoubtedly contains many curious and amusing portions, is,
however, disgraced by the author’s credulity and ill-founded
assertions. Kircher has been truly called ‘Vir immensæ quidem, sed
indigestæ eruditionis’—a man of immense but indigested learning.
Yet, with all its imperfections, the Musurgia contains much ‘curious
and useful information for such as know how to sift truth from
falsehood, and usefulness from futility;’ for a considerable portion of
which, however, he was indebted to the Harmonie Universelle of
Mersenne, which appeared in 1636; the Musurgia not having been
published till fourteen years later.
OTTO ON VIOLINS , &c.
[72]

THE professed object of M. Otto’s work is to guard purchasers of


violins, &c., against imposition, and to show how such instruments
may be kept in order and repaired. But it is quite clear that he has
prudently had the main chance in view, and, while thinking of the
interests of others, has not been unmindful of his own, for he takes
especial care to let his readers into the history of his business, where
he and his sons reside, and what—of course for ‘a consideration’—
they undertake to do in the way of trade.
But while advertising himself and Co.—perhaps very justifiably—
he has embodied in his pages a number of facts interesting to
amateur players, highly useful to professional performers, and
curious to all whose pursuits lead them to inquire into the state of
the mechanical arts, among which is to be reckoned the
manufacture of musical instruments; and if he has really taught ‘the
best means of preserving a good instrument, and of improving a
spoiled one,’[73] he has rendered a service which entitles him to the
gratitude of the musical world.
Many of our readers will be surprised to learn that a really good,
a complete violin, consists of fifty-eight different parts, which the
author thus describes:—
2 pieces for the back
2 ditto belly or sound-board
4 ditto corner blocks
2 ditto end blocks
6 ditto ribs or sides
12 ditto linings
1 ditto sound or bass bar
12 ditto purfling
1 ditto ebony rest for the tail-piece
1 ditto ebony or sometimes ivory nut
1 ditto ebony tail-piece
1 ditto ebony finger-board
4 ditto screws or pegs
1 ditto the neck
1 ditto button for the tail-piece
4 ditto strings
1 wire or catgut connecting the tail-piece with the button
1 sound post
1 bridge
58
‘The wood used in the manufacture of this instrument is of three
sorts. The back, the neck, the sides, and the circles are made of
sycamore; the belly, the bass bar, the sound post, and the six blocks
of Tyrolese deal; the finger-board and tail-piece of ebony.’
It appears that the peculiar curvature, or swell of the back and
belly of good violins, is produced by scooping out of the solid wood,
and not by pressing the material on heated moulds of the desired
shape, a practice which the translator, in a note, informs us is
common now in Germany, among the cheap makers.
M. Otto rather inclines to the opinion that violins might be now
made equal to the old Cremonese, and thinks that musicians and
dilettanti are blameable for not encouraging good makers, and for
putting too much confidence in repairers. He seems to be persuaded
that the rich, mellow tone of instruments depends much on the

You might also like