Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Address already in use!!..



"RamKumar" <email@hidden> wrote:

>We are facing the following problem in MacOSX 10.2. Our java Application
>throws this exception when it tries to get a image using URL object.

and:

>We tried running the code from other machine and it worked. But the
>issue is this product should run on a single machine.

Perhaps your one machine is running out of fd's. There is a per-process
limit, and that limit is 256 by default on 10.2. There is also an overall
limit for a machine, which you can see with this Terminal command:
sysctl kern.maxfiles

It's possible to change the limit by adding a prelude shell-script to your
app-bundle, a procedure described here:
<http://www.amug.org/~glguerin/howto/More-open-files.html>

Although the remedy is described as being for "more open files", each open
network connection also consumes 2 fd's, so the fd limit isn't just for
files on disk.

If the fd limit is the problem, I have no explanation for why this is
appearing as a SocketException with the message "Address already in use".


You might also consider packaging all your images up in a jar, retrieving
that once from a URL, and then pulling the images out as JAR-resources or
even as ZIP data-streams. This would only work if your images didn't
change and can be packaged together. It's impossible to tell that from
your posted code fragment, only that you're looping to load 20 images from
20 separate URLs.

-- GG
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.