Sponsored Content
Top Forums Programming socket problems with cc compile options??? Post 302188470 by googling2000 on Wednesday 23rd of April 2008 03:31:31 PM
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.
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
SYSTEMD-SOCKET-ACTIVATE(1)				      systemd-socket-activate					SYSTEMD-SOCKET-ACTIVATE(1)

NAME
systemd-socket-activate - Test socket activation of daemons SYNOPSIS
systemd-socket-activate [OPTIONS...] daemon [OPTIONS...] DESCRIPTION
systemd-socket-activate may be used to launch a socket-activated service program from the command line for testing purposes. It may also be used to launch individual instances of the service program per connection. The daemon to launch and its options should be specified after options intended for systemd-socket-activate. If the --inetd option is given, the socket file descriptor will be used as the standard input and output of the launched process. Otherwise, standard input and output will be inherited, and sockets will be passed through file descriptors 3 and higher. Sockets passed through $LISTEN_FDS to systemd-socket-activate will be passed through to the daemon, in the original positions. Other sockets specified with --listen= will use consecutive descriptors. By default, systemd-socket-activate listens on a stream socket, use --datagram and --seqpacket to listen on datagram or sequential packet sockets instead (see below). OPTIONS
-l address, --listen=address Listen on this address. Takes a string like "2000" or "127.0.0.1:2001". -a, --accept Launch an instance of the service program for each connection and pass the connection socket. -d, --datagram Listen on a datagram socket (SOCK_DGRAM), instead of a stream socket (SOCK_STREAM). May not be combined with --seqpacket. --seqpacket Listen on a sequential packet socket (SOCK_SEQPACKET), instead of a stream socket (SOCK_STREAM). May not be combined with --datagram. --inetd Use the inetd protocol for passing file descriptors, i.e. as standard input and standard output, instead of the new-style protocol for passing file descriptors using $LISTEN_FDS (see above). -E VAR[=VALUE], --setenv=VAR[=VALUE] Add this variable to the environment of the launched process. If VAR is followed by "=", assume that it is a variable-value pair. Otherwise, obtain the value from the environment of systemd-socket-activate itself. --fdname=NAME[:NAME...] Specify names for the file descriptors passed. This is equivalent to setting FileDescriptorName= in socket unit files, and enables use of sd_listen_fds_with_names(3). Multiple entries may be specifies using separate options or by separating names with colons (":") in one option. In case more names are given than descriptors, superfluous ones will be ignored. In case less names are given than descriptors, the remaining file descriptors will be unnamed. -h, --help Print a short help text and exit. --version Print a short version string and exit. ENVIRONMENT VARIABLES
$LISTEN_FDS, $LISTEN_PID, $LISTEN_FDNAMES See sd_listen_fds(3). $SYSTEMD_LOG_TARGET, $SYSTEMD_LOG_LEVEL, $SYSTEMD_LOG_COLOR, $SYSTEMD_LOG_LOCATION Same as in systemd(1). EXAMPLES
Example 1. Run an echo server on port 2000 $ systemd-socket-activate -l 2000 --inetd -a cat Example 2. Run a socket-activated instance of systemd-journal-gatewayd(8) $ systemd-socket-activate -l 19531 /lib/systemd/systemd-journal-gatewayd SEE ALSO
systemd(1), systemd.socket(5), systemd.service(5), sd_listen_fds(3), sd_listen_fds_with_names(3), cat(1) systemd 237 SYSTEMD-SOCKET-ACTIVATE(1)
All times are GMT -4. The time now is 10:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy