The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > HP-UX
.
google unix.com



HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Run a process through inetd using korn shell!!! vishi_82 Shell Programming and Scripting 8 06-11-2007 09:00 AM
Error inetd By_Jam IP Networking 6 02-15-2007 04:07 AM
VNC using inetd on HPUX punkdeviant HP-UX 0 10-23-2006 08:40 PM
refreshing inetd kswaraj Shell Programming and Scripting 3 06-24-2004 12:18 PM
Inetd and security ftn96 UNIX for Dummies Questions & Answers 8 05-28-2002 04:35 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-31-2006
binums binums is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 7
inetd process

--------------------------------------------------------------------------------
Hi All ,

I have a client an server among which i want to make the server an inetd process.

I have enries in etc/services and etc/inetd.conf
The enries looks like below
etc/services
servername 5551/tcp
etc/inetd.conf

servername stream tcp nowait root /servername servername

Now if I try to run my client ,inetd will spwan the server but the bind in the serve is failing synag tht address is already in use

My client code to connect ins ome thng like this
====================================
sd = socket (AF_INET, SOCK_STREAM, 0); CHK_ERR(sd, "socket");

memset (&sa, '\0', sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = inet_addr ("127.0.0.1"); /* Server IP */
sa.sin_addr.s_addr = inet_addr ("164.164.27.88");
sa.sin_port = htons (5551); /* Server Port number */

err = connect(sd, (struct sockaddr*) &sa,
sizeof(sa)); CHK_ERR(err, "connect");

/* ----------------------------------------------- */
/* Now we have TCP conncetion. Start SSL negotiation. */

ssl = SSL_new (ctx); CHK_NULL(ssl);
SSL_set_fd (ssl, sd);
err = SSL_connect (ssl); CHK_SSL(err);


and my server code is like below
==========================
/* Prepare TCP socket for receiving connections */

listen_sd = socket (AF_INET, SOCK_STREAM, 0); CHK_ERR(listen_sd, "socket");

memset (&sa_serv, '\0', sizeof(sa_serv));
sa_serv.sin_family = AF_INET;
sa_serv.sin_addr.s_addr = INADDR_ANY;
sa_serv.sin_port = htons (5551); /* Server Port number */

err = bind(listen_sd, (struct sockaddr*) &sa_serv,
sizeof (sa_serv)); CHK_ERR(err, "bind");

/* Receive a TCP connection. */

err = listen (listen_sd, 5); CHK_ERR(err, "listen");

client_len = sizeof(sa_cli);
//Binu
sd = accept (listen_sd, (struct sockaddr*) &sa_cli,(int *) &client_len);
CHK_ERR(sd, "accept");
close (listen_sd);


can any one please help me?

Thanks
Binu
  #2 (permalink)  
Old 05-31-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,122
You can't listen to a port and also ask inetd to do the listen. It's one or the other. inetd will do the bind, listen, and accept then fork and finally exec your server.
  #3 (permalink)  
Old 06-01-2006
binums binums is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 7
Can you please tell me how I can change my code ..
Thanks a lot in advance
Binu
  #4 (permalink)  
Old 06-01-2006
binums binums is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 7
Hi ,

Actually i have removed the bind calls as it is not required .Now the problem is that, I m not sure to which sd i have to do a read and write .

( I m using SSL server.Hence i m using SSL_read ,SSL_write etc )

Binu
  #5 (permalink)  
Old 06-01-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,122
0 and 1   
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0