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

  • Home
  • SEARCH
  • 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 8878999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:50:57+00:00 2026-06-14T19:50:57+00:00

I’m fairly new to c++ programming. I am trying to code a windows client

  • 0

I’m fairly new to c++ programming. I am trying to code a windows client that communicates to a linux server. That part I have successfully done.

Now I don’t know what to do to continue this.
This is what I need to do (but dont know how to).

Now my client asks for 3 stuff.
Example

 declared client variables 1,2,3 as string...

 Enter Anything: dgasggfds 
 //dgasggfds is now stored to cvariable1
 Enter Anything again: zxcasd
 //zxcasd is now stored to cvariable2
 Enter Anything again again: qwert
 //qwer is now stored to cvariable3

Now the client should send each of this variable to the server.
The server will then also use those variables and execute its codes.

So now on the server

 cvariable1 is now svariable1 on the server.
 cvariable2 is now svariable2 on the server.
 cvariable3 is now svariable3 on the server.

Once all the variable is there, it will execute a code.

Please advice. Thanks.

–edit–

I tried using send() recv() it works but I can only send 1 variable.
and I dont know how to set the recv data into a variable on the server.

–edit–

I kinda get how to save the recv data into a variable.
But still don’t know how to do it with the multiple data.

Also the 3 variables must always be together. they cant be separated.
The servers code needs those 3 variables/data to execute the cmds properly.

–edit–

Does this make any sense?

string* packet = new string[3];
packet[0] = 'var1';
packet[1] = 'var2';
packet[2] = 'var3';

//send request
if (send(sock, packet.c_str(), packet.length(), 0) != request.length())
    die_with_wserror("send() sent a different number of bytes than expected");

Its giving me some error though. packet:expression must have class type.

What I’m trying to do now is send it in an array, and break down the array once on the server, is this logic okay?

  • 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-14T19:50:58+00:00Added an answer on June 14, 2026 at 7:50 pm

    On client side concatenate the three variables using a special character to separate them, e.g.

    string sending = variable1 + "_" + variable2 + "_" + variable3;
    

    and send sending

    On server side

    ssize_t bytes_recieved;
    char incoming_data_buffer[1000];
    bytes_recieved = recv(socketfd, incoming_data_buffer,1000, 0);
    

    you will have your data in incoming_data_buffer. Now split incoming_data_buffer using “_”, you will have your 3 variables.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.