Copy Link
Add to Bookmark
Report

Java Coffee Break Newsletter Volume 1 Issue 02

                Java Coffee Break Newsletter Vol 1, Issue 2 
ISSN 1442-3790

Welcome to the second Java Coffee Break Newsletter! This issue comes
a little early, due to the large number of subscribers in the last
week, and because of the new tutorial that is now available.

- - - - - - - - - - - - - - - - - - - - - - - -
Java Coffee Break Updates

* New tutorial
* JDK 1.2 Booklist
* Free access to the latest resources from Sun


1. New tutorial

Learn the basics of network programming in Java, with the latest in
our series of tutorials aimed at beginners. Network programming can
be easy, and this tutorial will show you how to write Java clients.
A brief excerpt from the tutorial is included later in the
newsletter.

If networking is a little too advanced for now, try some of the
other tutorials, which teach Java right from the beginning.

All our Java tutorials can be found at
http://www.davidreilly.com/jcb/tutorials.html

2. JDK 1.2 Booklist

If you haven't been following the latest news from Sun, you may
not be aware that a new version of the Java Developers Kit (JDK)
is coming. JDK1.2 includes many new features, including support
for servlets, swing, collections and more.

If you're interested in getting up to speed with these
technologies, I've put together a booklist of some JDK1.2 titles.
You can find the list at
http://www.davidreilly.com/jcb/books/jdk1.2/

3. Free access to the latest resources from Sun

Sun's Java Developer Connection (JDC) offers developers early
access to software and toolkits (including early betas of JDK).
It's free, and helps you keep up to date.

Join JDC at http://java.sun.com/jdc/


- - - - - - - - - - - - - - - - - - - - - - - -
Java 109 - Networking with Java

In this tutorial, we'll cover networking with Java. Don't worry if
you're not familiar with networking - this will be only a brief
introduction. We'll examine some of the classes in the java.net
package, and show you how to write a simple network client in Java.
First, however, we need to cover some background theory.


How do computers talk to each other via the Internet?

The Internet is composed of millions of computers, located all across
the globe, communicating and transmitting information over a variety
of computing systems, platforms, and networking equipment.  Each of
these computers (unless they are connecting via an intranet) will
have a unique IP address.

IP addresses are 32-bit numbers, containing four octets (8 bit numbers)
separated by a full stop. Each computer with a direct internet
connection will have a unique IP address, (e.g. 207.68.156.61). Some
computers have temporary addresses, such as when you connect to your
ISP through a modem. Others have permanent addresses, and some even
have their own unique domain names (e.g. www.microsoft.com).

An IP address allows us to uniquely identify a device or system
connected to the Internet. If I wanted to connect to a specific IP
address, and send a message, I could do so. Without an IP address, my
message would have no way of reaching its destination - a bit like
leaving the address off a letter or parcel.


Internet Addressing with Java

Handling internet addresses (domain names, and IP addresses) is made
easy with Java. Internet addresses are represented in Java by the
InetAddress class. InetAddress provides simple methods to convert
between domain names, and numbered addresses.

We start by importing the java.net package, which contains a set of
pre-written networking classes (including InetAddress).

import java.net.*;

Next, we declare a new variable of type InetAddress, which we assign
the value of the local host machine (for machines not connected to a
network, this should represent 127.0.0.1). Due to the fact that
InetAddresses can generate exceptions, we must place this code between
a try .. catch UnknownHostException block.

// Obtain the InetAddress of the computer on which this program
// is running
InetAddress localaddr = InetAddress.getLocalHost();

The InetAddress class has methods that return the IP address as an
array of bytes (which can be easily converted into a string), as well
as a string representation of its domain name (e.g. mydomain.org ). We
can print out the InternetAddress, as well as the domain name of the local
address.

System.out.println ("Local IP Address : " + localaddr );
System.out.println ("Local hostname : " + localaddr.getHostName());

The full tutorial, including downloadable source code, is available at
http://www.davidreilly.com/jcb/java109/java109.html

- - - - - - - - - - - - - - - - - - - - - - - -

The Java Coffee Break Newsletter is only sent out to email subscribers
who have requested it. If you no longer wish to receive the JCB
Newsletter, please unsubscribe using the WWW form located at
http://www.davidreilly.com/jcb/newsletter/unsubscribe.html

← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

guest's profile picture
@guest
12 Nov 2024
It is very remarkable that the period of Atlantis’s destruction, which occurred due to earthquakes and cataclysms, coincides with what is co ...

guest's profile picture
@guest
12 Nov 2024
Plato learned the legend through his older cousin named Critias, who, in turn, had acquired information about the mythical lost continent fr ...

guest's profile picture
@guest
10 Nov 2024
الاسم : جابر حسين الناصح - السن :٤٢سنه - الموقف من التجنيد : ادي الخدمه - خبره عشرين سنه منهم عشر سنوات في كبرى الشركات بالسعوديه وعشر سنوات ...

lostcivilizations's profile picture
Lost Civilizations (@lostcivilizations)
6 Nov 2024
Thank you! I've corrected the date in the article. However, some websites list January 1980 as the date of death.

guest's profile picture
@guest
5 Nov 2024
Crespi died i april 1982, not january 1980.

guest's profile picture
@guest
4 Nov 2024
In 1955, the explorer Thor Heyerdahl managed to erect a Moai in eighteen days, with the help of twelve natives and using only logs and stone ...

guest's profile picture
@guest
4 Nov 2024
For what unknown reason did our distant ancestors dot much of the surface of the then-known lands with those large stones? Why are such cons ...

guest's profile picture
@guest
4 Nov 2024
The real pyramid mania exploded in 1830. A certain John Taylor, who had never visited them but relied on some measurements made by Colonel H ...

guest's profile picture
@guest
4 Nov 2024
Even with all the modern technologies available to us, structures like the Great Pyramid of Cheops could only be built today with immense di ...

lostcivilizations's profile picture
Lost Civilizations (@lostcivilizations)
2 Nov 2024
In Sardinia, there is a legend known as the Legend of Tirrenide. Thousands of years ago, there was a continent called Tirrenide. It was a l ...
Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT