Java Network Programming FAQCopyright 1. David Reilly. All Rights Reserved.
Last modification date : April 2. This document contains the answers to commonly asked network programming. Java developers. Copies of this document mirrored at other. The latest version of this document can be found at http: //www. BibMe Free Bibliography & Citation Maker - MLA, APA, Chicago, Harvard. ![]() Table of contents. Overview. Legal. Comments. Books. Websites. Basic programming questions. Socket Questions. Should I use Server. Socket or Datagram. Socket in my. applications? How do I get the IP address of a machine from its hostname? How do I perform a hostname lookup for an IP address? How can I find out who is accessing my server? How can I find out the current IP address for my machine? Why can't my applet connect via sockets, or bind to a local. What are socket options, and why should I use them? When my client connects to my server, why does no data come. What is the cause of a No. Route. To. Host exception? HTTP Questions. 2. How do I display a particular web page from an applet? How do I display more than one page from an applet? How can I fetch files using HTTP? How do I use a proxy server for HTTP requests? What is a malformed URL, and why is it exceptional? How do I URL encode the parameters of a CGI script? Why is a security exception thrown when using java. URL. orjava. net. URLConnection from an. How do I prevent caching of HTTP requests? Advanced programming questions. Advanced networking concepts. How do I handle timeouts in my networking applications? How do I control the amount of time a socket will linger. What does the java. Socket. set. Tcp. No. Delay method do, and. Nagle's algorithm? How do I implement a (FTP/HTTP/Telnet/Finger/SMTP/POP/IMAP/../). How do I implement PING in Java? How can I send/receive email from Java? Remote method invocation. What is remote method invocation? When should I use remote method invocation? Why can't I access RMI from C++? Why won't my RMI implementation compile under JDK1. Why won't my RMI implementation run under Java 2? Common Object Request Broker Architecture. What is CORBA? 5. When should I use CORBA? What support does Java have for CORBA? How do I start the CORBA nameservice for Java 2? Servlets. 6. 1 What are Java Servlets? What do I need to develop servlets? Where can I get more information on servlets? How does servlet performance compare to applets? How does servlet performance compare to CGI? Should I use single- threaded, or multi- threaded, servlets? How do I send cookies from a servlet? How do I read browser cookies from a servlet? How do I make cookies expire after a set time period? Why aren't cookies stored by my servlets accessible to my CGI scripts or. ASP pages? 6. 1. 1 How can I void a cookie, and delete it from the browser? This document contains the answers to commonly asked network programming. Java developers. If you have a question not addressed by this. My email is jnpfaq@davidreilly. This document is Copyright 1. David Reilly. All Rights are Reserved. No unauthorized mirroring or archiving of this FAQ is permitted, other than for. Print distribution, or distribution on. CD- ROM, WWW sites (personal or commercial), or other electronic distribution is. For redistribution rights, contact. This FAQ is no way connected with two books (published by Manning &. O'Reilly) by the same name. Java is a trademark of Sun Microsystems, and this. Sun Microsystems. This document is by no means complete, though hopefully it is error free : -). Anyone wishing to submit a question, or provide comments, can send email to jnpfaq@davidreilly. Most good Java books contain at least one chapter of information on. However, for the network programmer, this is invariably not. A trip to your local bookstore or library should turn up a. If not, the following resources might help you. Java Network Programming. Author. : Hughes, et al. ISBN : 1. 88. 47. XThis book is one of the best books to begin network. Java with. Not to be confused with an O'Reilly book of the same. Java Network Programming covers a wide range of topics, from datagrams. RMI), CORBA, Java servlets, and a heavy dose of cryptography and security. Packed full of code, this is the ultimate reference. A second edition of this. Java Platform 2, has just been released, and is highly. Java Network Programming. Author : Elliotte Rusty Harold. ISBN : 1. 56. 59. O'Reilly & Associates, in 1. Java Network. Programming". This book received favorable reviews in online stores like Amazon for the first couple of years. I've flicked through the title, and it doesn't cover newer. CORBA, new RMI features, or the revised servlet system development kit. A second edition of this title, bringing. The Java Tutorial. Author : Mary Campione and Kathy Walrath. ISBN : 0. 20. 13. Published by Addison- Wesley, and available on- line from Sun, the Java. Tutorial provides a great introduction to the Java language, as well as. RMI/CORBA. http: //java. The official source of any Java related information is Sun Microsystem's Java. Other. recommended sites include the following : -Site : Java Coffee Break. URL : http: //www. Features many Java networking articles about advanced networking topics, such. RMI & CORBA, as well as an introduction to networking tutorial. Site : Java Networking FAQ. URL : http: //www. The Java Networking FAQ is an older FAQ, and doesn't cover many of the newer. JDK1. 1 networking features. However, it's still a good reference for networking. Site : Java. World. URL : http: //www. Java. World is an online magazine, published monthly. Covers a wide variety of. Site : Jguru. URL : http: //www. Networking. Offers a collection of networking FAQs for Java. Basic programming questions. Should I use Server. Socket or Datagram. Socket in my. applications? Datagram. Socket allows a server to accept UDP packets, whereas Server. Socket. allows an application to accept TCP connections. It depends on the protocol. If you're creating a new protocol, here's a few tips. Datagram. Sockets communciate using UDP packets. These packets don't. Server. Sockets communicate using TCP connections. TCP guarantees delivery. Input. Stream and Output. Stream. How do I get the IP address of a machine from its. The Inet. Address class is able to resolve IP addresses for you. Obtain an. instance of Inet. Address for the machine, and call the get. Host. Address() method. Inet. Address inet = Inet. Address. get. By. Name("www. davidreilly. System. out. println ("IP : " + inet. Host. Address()); How do I perform a hostname lookup for an IP address? The Inet. Address class contains a method that can return the domain name of an. IP address. You need to obtain an Inet. Address class, and then call its. Host. Name() method. This will return the hostname for that IP address. Depending on the platform, a partial or a fully qualified hostname may be. Inet. Address inet = Inet. Address. get. By. Name("2. 09. 2. 04. System. out. println ("Host: " + inet. Host. Name()); How can I find out who is accessing my server? If you're using a Datagram. Socket, every packet that you receive will contain. Datagram. Packet packet = null. Receive next packet. Datagram. Socket. Print address + port. System. out. println ("Packet from : " +. Address(). get. Host. Address() + ': ' + packet. Port()); If you're using a Server. Socket, then every socket connection you accept will. The Socket class has a get. Inet. Address() and get. Port(). method which will allow you to find the same information. Socket my. Sock = my. Server. Socket. accept(). Print address + port. System. out. println ("Connection from : " +. Sock. get. Inet. Address(). Host. Address() + ': ' + my. Sock. get. Port()); How can I find out the current IP address for my. The Inet. Address has a static method called get. Local. Host() which will return. You can then use the get. Host. Address(). method to get the IP address. Inet. Address local = Inet. Address. get. Local. Host(). // Print address. System. out. println ("Local IP : " + local. Host. Address()); Why can't my applet connect via sockets, or bind to a. Applets are subject to heavy security constraints when executing under the. Applets are unable to access the local file- system, to. While it may seem to be an annoyance. Applets could bind to well known ports, and service network. Applets executing within firewalls. Applets could even be infected by viruses, such as the Java Strange. Brew strain. Applets might become infected without an applet author's knowledge and then send. Signed applets may be allowed greater freedom by browsers than unsigned. In cases where an applet must be capable of.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |