Operating System - HP-UX
1838048 Members
4072 Online
110124 Solutions
New Discussion

Problem with socket() call.

 
Tony Escujuri
Occasional Advisor

Problem with socket() call.

I'm having a strange problem in my application. I'm using the socket(), and it isn't returning a value. It's acting like it's blocking. Has anyone heard of this condition before?
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor

Re: Problem with socket() call.

Hi Tony,

I suggest that you post as small a piece of code as possible that exhibits the problem and I suspect someone can then help.
If it ain't broke, I can fix that.
Tony Escujuri
Occasional Advisor

Re: Problem with socket() call.

Here's the code. The last thing printed to the log file is "before socket
Rocky Zhao
Occasional Contributor

Re: Problem with socket() call.

Did you start your app two times? if your app is a server, the new one maybe blocked
try new technology
Tony Escujuri
Occasional Advisor

Re: Problem with socket() call.

If anybody is interested, I've figured out the problem. My program wasn't closing it's file descriptors, and as it ran it reached the maximum number allowed per process. I was using the shutdown() function instead of close(). I thought that the shutdown function closed the filehandle if you closed both the read/write streams, but I was mistaken. Here's the interesting part though. The socket() function didn't return an error reporting this, it just hung there. This appears to be a bug. I've fixed my program so it closes the file descriptors, so it's not a problem. But I'm sure someone else will run into this. Where is the best place to report this?