socket problems with cc compile options???


 
Thread Tools Search this Thread
Top Forums Programming socket problems with cc compile options???
# 1  
Old 04-23-2008
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.
# 2  
Old 04-24-2008
how you are doing exec(). Could post the exec code.
# 3  
Old 04-24-2008
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.
# 4  
Old 04-24-2008
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.
# 5  
Old 04-24-2008
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"
# 6  
Old 04-25-2008
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Looping problems socket programming in C

Sorry if I posted 2 separate questions. I'm currently doing socket programming on my current task. As you can see below in the client side. I've tried to do a loop so I will be able to get prompt for input over and over again. This is the code. do{ printf("Please your name > ");... (10 Replies)
Discussion started by: aLHaNz
10 Replies

2. IP Networking

Clarification - Setting socket options at the same time when socket is listening

I need clarification on whether it is okay to set socket options on a listening socket simultaneously when it is being used in an accept() call? Following is the scenario:- -- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Discussion started by: jake24
2 Replies

3. Shell Programming and Scripting

bash script to compile multiple .c files with some options

I'm trying to write a bash script and call it "compile" such that running it allows me to compile multiple files with the options "-help," "-backup," and "-clean". I've got the code for the options written, i just can't figure out how to read the input string and then translate that into option... (5 Replies)
Discussion started by: travis.batzer
5 Replies

4. UNIX for Dummies Questions & Answers

Compiling gcc to compile make to compile yaboot

I have just installed OpenBSD on a 333MHz PPC iMac G3. It has a 6GB HDD that has been partitioned as 1GB MacOS 8.5.1, 3GB MacOS X 10.3.9, 2GB OpenBSD 4.8. I now need to install a bootloader so that my computer can recognize the OpenBSD partition at startup. I have been trying to install... (0 Replies)
Discussion started by: t04st3r
0 Replies

5. Solaris

Socket options

Hi everyone, Question for gurus: Is there a way for us to determine the options used by a socket? I basically want to know if SO_KEEPALIVE is enabled on a socket to know if the tcp_keepalive_abort_interval parameter will be used by that connection. Was I clear enough? :confused: ... (0 Replies)
Discussion started by: plmachiavel
0 Replies

6. Programming

socket function to read a webpage (socket.h)

Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct... #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include... (3 Replies)
Discussion started by: cyler
3 Replies

7. UNIX for Advanced & Expert Users

connect problem for sctp socket (ipv6 socket) - Runtime fail Invalid Arguments

Hi, I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime. To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies

8. Programming

Please help! accept function problems in Socket programming

Hi, I have a client-server socket program. It has been working fine for over a year, but recently it started to show strange behavior.:confused: After the server program runs for a while, it will show in the top command saying it is using lots of CPU, MEM. I assume it means the server code is... (1 Reply)
Discussion started by: natxie
1 Replies

9. IP Networking

socket options

Hello there The socket option IP_OPTIONS returns an integer value, supposed to be the contents of the IP header. Could you please help me out to interpret those values. ThankYou. (1 Reply)
Discussion started by: hufs375
1 Replies
Login or Register to Ask a Question