inetd SSL -server
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > inetd SSL -server




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    inetd SSL -server  
Binu


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-14-06 12:26 PM

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);
printf ("Connection from %lx, port %x\n",
sa_cli.sin_addr.s_addr, sa_cli.sin_port);

/* ----------------------------------------------- */
/* TCP connection is ready. Do server side SSL. */

//binu _
ssl = SSL_new (ctx);                           CHK_NULL(ssl);
SSL_set_fd (ssl, sd);
err = SSL_accept (ssl);                        CHK_SSL(err);




can any one please help me?

Thanks
Binu






[ Post a follow-up to this message ]



    Re: inetd SSL -server  
Gordon Burditt


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-14-06 12:26 PM

>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

If inetd is accepting the connection and handing it off to the
server, is the server even supposed to be trying to bind a socket?
Didn't inetd do that already?

Example:  if you're running Apache from inetd, you need to tell it
it's being invoked from inetd with "ServerType inetd" rather than
"ServerType standalone".

Gordon L. Burditt





[ Post a follow-up to this message ]



    Re: inetd SSL -server  
Binu


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-14-06 12:26 PM


Gordon Burditt wrote: 
>
> If inetd is accepting the connection and handing it off to the
> server, is the server even supposed to be trying to bind a socket?
> Didn't inetd do that already?
>
> Example:  if you're running Apache from inetd, you need to tell it
> it's being invoked from inetd with "ServerType inetd" rather than
> "ServerType standalone".
>
> 						Gordon L. Burditt


if I remove bind and accept ,  i dont know hich ffd i should use to
read and write






[ Post a follow-up to this message ]



    Re: inetd SSL -server  
davids@webmaster.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-14-06 12:26 PM


Binu wrote:

> if I remove bind and accept ,  i dont know hich ffd i should use to
> read and write

You need to read up on how to write a server that's launched from
'inetd'.
See, for example:
[url]http://www.cs.bham.ac.uk/resources/courses/2005/17423/doc/libc/Inetd-Servers.html[
/url]

DS






[ Post a follow-up to this message ]



    Re: inetd SSL -server  
Barry Margolin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-15-06 12:22 AM

In article <1150275727.330263.85720@y43g2000cwc.googlegroups.com>,
"Binu" <msbinu@gmail.com> wrote:

> if I remove bind and accept ,  i dont know hich ffd i should use to
> read and write

When inetd invokes a server, the socket is automatically connected to
stdin (fd 0) and stdout (fd 1).

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***





[ Post a follow-up to this message ]



    Re: inetd SSL -server  
Binu


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-19-06 06:23 AM


Barry Margolin wrote:
> In article <1150275727.330263.85720@y43g2000cwc.googlegroups.com>,
>  "Binu" <msbinu@gmail.com> wrote:
> 
>
> When inetd invokes a server, the socket is automatically connected to
> stdin (fd 0) and stdout (fd 1).
>
> --
> Barry Margolin, barmar@alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***
> *** PLEASE don't copy me on replies, I'll read them in the group ***

Thanks.

If you are good in SSL , can you pls tell me how to modify my SSL code(
whihc is given above )






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 07:14 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register