|
-
March 13th, 2013, 10:12 AM
#5
Re: Winsock Math Operations client \ server
As always 2kaud, Thanks in advance for your insight. It's greatly valued.
As you referenced, I am using the very same code as the last exercise, which accepts command arguments and establishes a connection.
So on the client end, I took a crack at adding some code to prompt the end-user.
I'm able to retrieve all the info from the user and stuff it in 3 variables from the client side, see code:
HTML Code:
float f1;
float f2;
char mFunc;
// Prompt user for two floating point numbers and what math operation.
cout << "Enter the first decimal number." << endl;
cin >> f1;
cout << "Enter the second decimal number." << endl;
cin >> f2;
cout << "Which mathmatical operation would you like to use? (+, -, *, /)" << endl;
cin >> mFunc;
cout << "You've entered " << f1 <<" " << mFunc << " "<< f2 << " to be calculated. Sending to server for processing, One moment please." << endl;
but if I'm reading you correctly, I'd need to send that in a string to the server in this portion of code:
HTML Code:
sprintf(szBuf, "From the Client [%s]", szSvr);
nRet = send(theSocket,
szBuf,
(int)strlen(szBuf),
0);
Have I missed the boat completely, or am I on the right track?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|