Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8395405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:17:34+00:00 2026-06-09T20:17:34+00:00

I am trying to add SSL functionality to my existing TCP echo client-server application.

  • 0

I am trying to add SSL functionality to my existing TCP echo client-server application.

Earlier in my simple server, I was spawning a new child for every incoming client connection. To this child, I was passing the conn-fd (char*) as a command-line argument. (shown below)

execl("./simple_server_instance", conn_fd, NULL);

Now, for my secure server, I need to pass a CYASSL object (a structure in effect) instead of the conn_fd. (shown below)

ssl = CyaSSL_new(ctx);
CyaSSL_set_fd(ssl, connfd);

Here ‘ssl’ is the object that needs to be passed to the child process. I tried the following ways to achieve it, but unsuccessful. Is there a simple alternative, or should i go the serialization way?

  1. Typecasting the ssl object to char*

  2. Creating a buffer and doing a memcpy of the entire structure. (shown below)

unsigned char sslobjbuf[sizeof(ssl)];
memcpy(&sslobjbuf, ssl, sizeof(ssl));
execl("./secure_server_instance", "hello", "25", sslobjbuf, NULL );

sdsd

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:17:35+00:00Added an answer on June 9, 2026 at 8:17 pm

    When you execl() a process, you completely replace the running process with the exec’ed process. The exec family of functions expect a sequence of null terminated strings which will become available as arvg[] in the spawned application. You can’t just pass arbitrary objects via this interface.

    When you probably want to use instead is the fork system call which gives you a new child process which shares its code/data with the parent. The code for ./simple_server_instance would be merged with the main server code. You can do your ssl = CyaSSL_new(ctx); call in the parent process to obtain the object you require, then fork. The parent can then continue to serve new requests while the child runs the the ssl object.

    Something like this flow of control may work:

    while (1) {
        wait_connection();
        pid_t child_pid = -1;
        ssl = CyaSSL_new(ctx);
        child_pid = fork();
        if (child_pid == 0) {
            /* We're now running the child process which also has access to ssl.
             * Run simple_server_instance handler code
             */
        }
        else {
            /* Code running in parent.  Do housekeeping, save child_pid if necessary.
             * clean up ssl, object, get ready for next connection, handle finished
             * child processes.
             */
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a server application using select.select(), and now I'm trying to add SSL
I'm trying to add SSL to an existing CORBA app, and I keep getting
I am new to ROR. I am trying add translations to my application. I
Im new to asp.net mvc. I'm trying add new model class but it got
I'm trying to add SSL session resumption to my project. Is there some settings
I'm trying to add ssl to my rails 3.0.7 app using the ssl requirement
I'm trying to add authenticating proxy support to an existing script, as it is
I am trying to use a web service (https/ssl/basicHttpBinding). I add service reference without
Im trying to change how email clients auto add my mail server settings. How
Im trying to make a ssl client that connects to ssl IRC Servers but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.