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 6721027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:16:53+00:00 2026-05-26T09:16:53+00:00

I need to send an object file from my client to the server program.

  • 0

I need to send an object file from my client to the server program.
I tried reading the file, storing it into a buffer, sent the buffer over the ssl and wrote to a file in the server program.
This did not work for .o files. This was the out put ELF.

This is some of my code

Read file

void readFile(char filename[])  
{
    FILE        *input_file;
    char        line[BUFSIZ];

    input_file = fopen(filename, "r");

    if(input_file == NULL){
        printf("cannot open input_file '%s'\n", filename );
        exit(EXIT_FAILURE);
    }

while (fgets(line,sizeof line, input_file) != NULL) {

    for(int i = 0; i<strlen(line); i++){
        current_file[i] = line[i];
    }   
}}

Client sends the file

    readFile(filename);
    ctx = InitCTX();  
    server = OpenConnection(hostname, atoi(portnum));  
    ssl = SSL_new(ctx);      /* create new SSL connection state */  
    SSL_set_fd(ssl, server);    /* attach the socket descriptor */  
    if ( SSL_connect(ssl) == FAIL )   /* perform the connection */  
        ERR_print_errors_fp(stderr);  
    else  
    {   

        printf("Connected with %s encryption\n", SSL_get_cipher(ssl));  
        ShowCerts(ssl);        /* get any certs */  
        SSL_write(ssl, current_file, strlen(current_file));

Is it possible to read object file, and then store it in a buffer?

Is there other methods to send these file?

  • 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-05-26T09:16:54+00:00Added an answer on May 26, 2026 at 9:16 am

    There’s nothing ‘special’ about a .o file, it’s simply a series of bytes stored on disc, with a filename and extension assigned to it.

    My guess would be that you need to handle the file differently from what you have there, as it’s going to be binary data. It won’t have the ‘usual’ concept of lines that you’re currently reading in.

    I’d have a look at the following:
    http://www.linuxquestions.org/questions/programming-9/c-howto-read-binary-file-into-buffer-172985/

    Try reading then writing your file locally first to check whether it’s being corrupted in transit or in the local I/O routines?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need send certain attributes(say, human readable user name) from server to client after
To send data to a file on my FTP server, I need to create
I need to be able to send an email from a silverlight client-side application.
I need to send and receive data over serial connections (RS-232 and RS-422). How
I need to send a very specific (non-standard) string to an FTP server: dir
I need to send a CSV file in HTTP response. How can I set
I need to send emails to a list of IDs from the contact application,
We need to send uploaded files from our CMS website to any antivirus product
When I pick a file and click Send it to the Server I get
I need to get data from a XML file from Node1>Node2 Filter data to

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.