Archive | Networking RSS feed for this section

Reading and writing to a socket (a simple server)

22 Apr

Reading and writing to a socket (a simple server)
The program below represents a very simple server. It listens on port 80 for clients requesting connections. When it detects a client connection request, it creates a socket to communicate with the client, creates a BufferedWriter, and then writes a simple web page to that socket. It [...]

Reading and writing to a socket (a simple client)

22 Apr

Reading and writing to a socket (a simple client)
The following program is a very simple HTTP client. Given an Internet address such as www.java.sun.com and a web page such as index.html, it initiates a socket com- munication to the well-known port 80 (HTTP services) and requests a web page. The web page is printed [...]

Network Programming

22 Apr

Network Programming
One of the strong points of Java is that the language has networking capabilities built in. This section will briefly highlight some of the capabilities that are most relevant to the hardware projects we’ll be considering later, particularly sockets, ports and URLs.
In the previous chapter on networks we discussed the TCP/IP protocol stack. The [...]

Errors, exceptions, and exception handling

22 Apr

Errors, exceptions, and exception handling
Nothing is worse than software that crashes. Java provides a method for handling software errors through what is known as exception handling. This section will briefly discuss exceptions and exception handling, including:
• Definition of exceptions and exception handling
• Different types of exceptions
• Exception examples: a specified exception, our very own exception
An [...]

Significant Topics for Review in the Java Language

22 Apr

Significant Topics for Review in the Java Language
The previous section discussed how to obtain and set up Java for both Windows and Linux personal computers. Now, we’re going to talk briefly about the Java language itself. Again, we’re not trying to teach you Java—rather, we’re going to cover aspects of the language that are especially [...]