File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes java.lang.OutOfMemoryError in Socket Programming in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "java.lang.OutOfMemoryError in Socket Programming in Java" Watch "java.lang.OutOfMemoryError in Socket Programming in Java" New topic

java.lang.OutOfMemoryError in Socket Programming in Java

Kaushik Mehta

Joined: Feb 10, 2003
Posts: 4
I ve a program which starts 2 threads. One thread opens a server socket that listens for any clients to connects to it. Once a client connects it would read whatever the client sends to it and then some processing is done and reply is sent thru the other thread. My problem is keep getting this error sometime after the program starts running. I first thought this might be due to improper creation and destroying of objects. But this error crops up even when there are no client connections(I create other objects only when a client connects. before that only 2 theads are created). So even if the Server Socket just keeps listening for client connections, after sometime this message crops up and no further clients can connect. Please help me.
Thanks in advance,
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Maybe you could show us some code. WHen there are no clients, the server should just be stuck at a call to "accept()," and this shouldn't be using any resources as all.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: java.lang.OutOfMemoryError in Socket Programming in Java
It's not a secret anymore!