The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sed h and g options sivasenthil_k Shell Programming and Scripting 9 01-04-2006 06:21 AM
Socket Programming socket soshell High Level Programming 2 06-29-2004 04:49 AM
cat and wc options Laura01 Shell Programming and Scripting 1 09-08-2002 08:21 PM
socket options hufs375 IP Networking 1 05-09-2002 10:02 AM
cp options milage UNIX for Dummies Questions & Answers 3 07-12-2001 09:20 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 04-23-2008
Registered User
 

Join Date: Apr 2008
Posts: 4
socket problems with cc compile options???

Hi there, a newbie as far as compiling c.
I have a problem, I've ported a fairly simple perl socket program over to c.

I compiled it as follows

cc simplesocket.c -lsocket -lnsl

compiles great, no errors.

When I launch it from the command line, it works great!!!!

However, if I launch this program from within another socket program
( a perl socket server (listener) program, basically doing an exec of this compiled program ).
The server program has no problems launching any other kinds of socket apps.

Is there some option I need to tell the compiler that will tell the program it will be running beneath another socket program????

Once again a newbie, any help appreciated.
Reply With Quote
Forum Sponsor
  #2  
Old 04-23-2008
Registered User
 

Join Date: Feb 2008
Posts: 18
how you are doing exec(). Could post the exec code.
Reply With Quote
  #3  
Old 04-24-2008
Registered User
 

Join Date: Apr 2008
Posts: 4
socket problems with cc compile options???

There's really not much to the exec. ( actually it's backtick )


It's perl, so it looks like this, ( not that it looks much different )


$rc = `$path/simplesocket.bin >>/tmp/logging.txt 2>&1`;

Note, the launching program does not core or abend, it's just the socket program itself.
Reply With Quote
  #4  
Old 04-24-2008
Registered User
 

Join Date: Feb 2008
Posts: 18
Could you post both sokcet program code and perl code. So that we can have look at that. By the information till now, no guesses about the problem.
Reply With Quote
  #5  
Old 04-24-2008
Registered User
 

Join Date: Apr 2008
Posts: 4
I don't think the code is to blame here.
I'm wondering if there is some compiler option that I'm not setting properly.

Remember the client code works fine.
I can execute it manually from the command line.
I can stick it into a shell script and execute it fine from there too.
I can run it from a program and it works great.
I can run is a differnt user, no problem.

The server code works fine too.
No problems with 400K launches per month, for the last 10 years.
It has no problems launching other binaries or shell or perl scripts.

Is there some option that "helps" compile a socket program that must run withing a socket program?
Like maybe I need to include some libraries on the compile line or some flags telling it "remember you have to live with some other sockets here"
Reply With Quote
  #6  
Old 04-25-2008
Registered User
 

Join Date: Feb 2008
Posts: 18
To compile socket programs, we don't any special options. You may try to build a simple C progam which need some other library (apart from stanard library, may use math library). Then try to execute this using your perl program.

Try to provide -static option with cc.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:55 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0