Sect. 15) How do I "timeout" a socket read, as the "select" function in Unix does?
Java Programmer's FAQ - Part DURLConnection doesn't have a method for this, but you can do it by using multiple threads. Create a timer thread that would just track time and close the connection after your specified timeout period. Check the URLConnection to see if it's got any data flowing through it (calling URLConnection.connected() is probably a sufficient test). The URLConnection should be in a separate thread. That approach will be inefficient for a large number of streams.
Sect. 15) Why, when I make a call to DatagramPacket.getlength() does it returns the wrong size?
Java Programmer's FAQ - Part DYou are probably reusing a Datagram packet, and it has no way to grow its buffer if a longer packet comes in. Take care of it by calling setLength(max) before reuse.
Why does submitting to SpamCop results in an error/timeout?
SpamCop FAQUsers are able to reach the SpamCop site and parse/report small emails, but when trying to submit a large spam through the website form they get a time-out error after clicking the "parse" button. This is a problem experienced by users with firewalls. It may be a personal hardware/software firewall you have employed or, there may be a firewall on your ISP's network "protecting" you that you are not necessarily aware of.
Sect. 15) How can I write the "ping" program?
Java Programmer's FAQ - Part DYou can't do it directly. Quoting from the Java Networking FAQ, Ping requires ICMP packets. These packets can only be created via a socket of the SOCK_RAW type. Currently, Java only allows SOCK_STREAM (TCP) and SOCK_DGRAM (UDP) sockets. It seems unlikely that this will be added very soon, since many Unix versions only allow SOCK_RAW sockets to be created by root, and winsock does not address ICMP packets (win32 includes an unsupported and undocumented ICMP.DLL).
What UNIX workstations does it run on ?
GMT - Frequently Asked GMT QuestionsGMT has been installed on a variety of UNIX systems, including (but not limited to) computers from Cray, Sun, IBM, DEC, HP, SGI, Data General, Apple (Mac OS X), and Next, all running some flavor of UNIX. GMT has also been installed under Linux and MkLinux, which are open source UNIX-like operating systems for PC and Mac OS 9, respectively. GMT also installs under Windows and OS/2. GMT is very portable and should compile on almost any computer.
How do I read mail on the UNIX system?
OCF Mail - Sorting and HandlingThere are many mail programs available on the UNIX system. One of the most common and easiest to use programs is called pine. Pine can be run from the UNIX prompt simply by typing pine at the UNIX prompt. Much of the user interface is simple and the one-keystroke commands are listed at the bottom of the screen. Type man pine for more information.
Sect. 15) Should I use CORBA in preference to RMI? Or DCOM? Or what?
Java Programmer's FAQ - Part DIf your distributed programs are wholly written in the Java programming language, then RMI provides a simpler mechanism that allows the transfer of code, pass-by-value of objects, and automatic garbage collection of remote objects. If you need to connect to C++ (or other language) systems or you need CORBA-specific services, then CORBA is your choice. In Java 1.3 Sun has aligned RMI to work more closely with CORBA.
Sect. 15) RMI seems to have stopped working for me in JDK 1.1. Why is this?
Java Programmer's FAQ - Part DThe rules for where the client looks for a stub class seem to have changed making it necessary to reset your class path on the client after starting the RMI registry. In particular, it looks like rmic was not updated to the new "don't need $CLASSPATH for current dir" convention as the compiler was. You are best off setting classpath explicitly. There are several very good sources available from Sun which cover many simple and advanced RMI problems.
Sect. 15) How do I map between IP address and hostname?
Java Programmer's FAQ - Part DIn Java 1.1 (earlier releases were buggy) use: String host = InetAddress.getByName("211.10.2.119").getHostName(); Sect. 15) How do I embed an anchor in a URL? Just putting it as part of the string in the constructor doesn't work. Like this: URL url = new URL("http://www.my_domain.com/my_page.html"); URL anchor = new URL(url, "#section2"); this.getAppletContext().showDocument(anchor);
Sect. 15) How do I POST to a CGI script from an applet?
Java Programmer's FAQ - Part DPOST passes the form data to the next page as part of the HTTP headers, while GET sends the data appended to the URL as a querystring. in the manner of http://www.someurl.com/page.htm?varname=value. POST and GET are different ways of transmitting form data to a server-side application. GET is limited to a small amount of text data that can be appended to the address. POST handles larger amounts of text and binary data and does not show up in the address URL.
Sect. 15) How can I write CGI programs in the Java programing language?
Java Programmer's FAQ - Part DCGI (the Common Gateway Interface for web servers) is an API for writing programs that use the web as its user interface. By far, the most popular language for this task is Perl, because of its powerful text handling capabilities, and excellent resources available for making the jobs of CGI programmers easier. CGI programs can be written in any language, including Java. Unfortunately, the interface between the web server and the CGI program uses environment variables extensively.
Sect. 15) Why do my networking programs freeze on the Mac?
Java Programmer's FAQ - Part DYou shouldn't println to a socket. This is the subject of Apple Technical Note 1157 at http://developer.apple.com/technotes/tn/tn1157.html The problem is that many socket protocols expect CR+LF to terminate a string, but println delivers a platform-specific EOL mark. On the Mac, it is just CR. Therefore the server hangs waiting for the Mac to send a LF. It never does. But the program works fine on platforms that send CR+LF.
Why does CU@Home timeout after I log in?
SCE Federal Credit UnionMicrosoft has confirmed that there is a software flaw in Internet Explorer with Content Advisor enabled. This will be resolved with a future patch from Microsoft; however, there are two immediate options for solving this issue: Go to Tools in your Internet Explorer browser and click on Internet Options. The Options window will open. If you do not wish to disable the Content Advisor, another option is to use another, more secure browser called Mozilla Firefox.
Why does the bar have 15 grams of fat?
Empower Net Products FAQOne of the most valuable nutrient this bar supplies is Essential Fatty Acids or EFAs. Fats are probably the most maligned and misunderstood nutrient in America today. The vast majority (85-95%) of ALL the people living in the United States are deficient in EFAs. There is a critical need for them in our diet and that is why there is so much of them in the bar. Don't confuse these 15 grams of EFAs with the unhealthy, unnecessary, and harmful saturated fat that permeates most snack and fast foods.
What does the usual 15 page site contain?
FAQs : web2growIn addition to the usual pages contained within a 7 page site, a 15 page site can go into much further detail and provide much more information on each category. This could be, for instance, newsletter pages that run off your email marketing (when the customer has read the teaser from your newsletter, they can read the rest of the article on your site) and is a great means to drive clients to your site.
Drive 10 does not allow me to select the Read/Write tests. Why not?
OSXFAQ - Technical News and Support for Mac OS XIt is possible the privileges for the drive are set to Read Only. If this is the case, change them to Read/Write. You can check and change the privileges via the Show-Info window.
Sect. 18) How can you send a function pointer as an argument?
Java Programmer's FAQ - Part DSimple answer: use a "callback". Make the parameter an interface and pass an argument instance that implements that interface. public interface CallShow { public void Show( ); } public class ShowOff implements CallShow { public void Show( ) { .... } public class ShowOff2 implements CallShow { public void Show( ) { .... } public class UseShow { CallShow savecallthis; UseShow( CallShow withthis ) { savecallthis = withthis; } void ReadyToShow( ) { savecallthis.
All my uploads timeout with "Listener Timeout". What does that mean?
XNap - FAQYou can either use firewalled mode (Network preferences) or you can forward your incoming port (OpenNap preferences) to your firewalled machine.
How do I clean my socket?
Wills Eye Health System - Frequently Asked Questions - Excel...Special care must be taken with the socket until healing is complete. In the immediate time period after your surgery, the closed eyelid should be wiped gently with a cotton ball moistened with the sterile eye solution given to you when you are discharged; drops or ointment may also be prescribed. This helps to keep the socket free from infection. The healing process usually takes about two to four weeks. When you receive your ocular prosthesis, you may wash your face normally.
Sect. 15) I want to pass a class file to willing recipients who are using my applet. Any ideas how?
Java Programmer's FAQ - Part DYou could use a trick: put your .class file(s) in a .zip archive and use showDocument() on the URL. A person accessing this will get a dialog box put up asking them about saving the file to their local hard disk. This is typically needed for any net access to another domain. Tell the run time system what you are trying to do, by using these commandline arguments when you start the program.
