LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-20-2005, 07:09 AM   #1
dssoft
LQ Newbie
 
Registered: Jul 2005
Location: Ukraine
Posts: 1

Rep: Reputation: 0
Problem with my Linux daemon


Help me to solve following problem.

I have: Red Hat Linux release 9 (Shrike) + Apache 2.0.40. I have written small PHP script which executes the C++ program (myprogram) using exec() function. myprogram does fork() and runs as daemon. myprogram opens one outbound tcp connection and does not listen any ports. After calling PHP script from browser, it runs C++ program, all works fine.

Now I wish to stop web server. I do: service httpd stop. The server stops. But when I have tried to start it again, have seen such mistake:

make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down

I have entered netstat -nlp and have seen the following:

Code:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
...
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      14656/myprogram
...
myprogram listen on server's port! If I start two copies of program, they listen on 80 and 443 ports.

How it can be? And how I can fix it?

Thanks.
 
Old 07-21-2005, 09:43 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
hi,
i don't know anything about php. but in c exec() actually replaces the calling process so the connection is most likely being passed as an argument to the new process.
also exec() never returns which is why in c you would fork before you use exec so exec becomes a child and gets killed off when the parent dies.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Settings daemon problem Draiocht Slackware 2 09-14-2005 08:00 PM
Gnome Settings Daemon Problem namish Linux - Software 0 08-01-2005 02:10 PM
'Daemon Tools' for linux? mrgrieves Linux - Software 9 08-24-2004 03:27 AM
How to run daemon in linux sansk Programming 1 03-18-2004 01:38 PM
Problem With LISA Daemon DeadCell Linux - General 1 01-06-2003 11:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration