Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: parlier@jpl-devvax.jpl.nasa.gov (Randy Parlier)
Subject: setsockopt() problems!!
Date: Thu, 22 Apr 1993 12:07:30 GMT	[thread overview]
Message-ID: <1993Apr22.120730.8906@jpl-devvax.jpl.nasa.gov> (raw)


	(Sorry, this was supposed to go to comp.unix.osf.osf1)

	I am attempting to port some socket code to OSF/1 originally 
	written on a Sun.

	Below is a portion of the code I am having trouble with.  
	setsockopt() always returns -1 and perror prints "Socket is not
	connected".

	Can anyone point out where/what I'm doing wrong??  I'm running 
	OSF/1 on a DEC Alpha OS release version 1.2.

	Thanks

	Randy
	parlier@puente.jpl.nasa.gov

	P.S.  Does OSF/1 or SYSVr4 have a command similiar to the 'trace'
	command on SunOS?

----------------- Here's the code ----------------

create_control_socket()	/*  Set up socket for listening to control msgs.  */
{
	int	error_found;

	control_inet_name_ptr = (struct sockaddr_in *) (&control_socket_name);
	control_inet_name_ptr->sin_family = AF_INET;
	control_inet_name_ptr->sin_port = CONTROL_PORT;
	control_inet_name_ptr->sin_addr.s_addr = INADDR_ANY;
	
	control_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
	if (control_socket == NONE)
	{
		perror("TPSEXEC failed on control socket call");
		exit(1);
	}

	error_found = setsockopt(control_socket, SOL_SOCKET,
			SO_REUSEADDR, 0, 0);
	if (error_found)
	{
		perror("TPSEXEC failed on control port setsockopt");
		exit(1);
	}
	
	error_found = bind(control_socket, &control_socket_name,
			sizeof(control_socket_name));
	if (error_found)
	{
		perror("TPSEXEC failed on control socket bind");
		exit(1);
	}
	
	error_found = listen(control_socket, 2);
	if (error_found)
	{
		perror("TPSEXEC failed on control socket listen");
		exit(1);
	}

	FD_SET(control_socket, &multiplex);
	return;
}		/*  End of create_control_socket routine.  */






             reply	other threads:[~1993-04-22 12:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-04-22 12:07 Randy Parlier [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-04-22 11:58 setsockopt() problems!! Randy Parlier
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox