?
Solved

Connecting to a server from MFC program.

Posted on 2003-03-11
6
Medium Priority
?
192 Views
Last Modified: 2013-11-25
I have a simple MFC program that has 4 CString variables that I need to send to a server. The server then works with these variables. How can I make this connection with the server? I think I need to use CInternerSession and CHttpConnection but I´m not sure how to do it. Any suggestions? Then again what would be the best thing to run on that server VBScript, COM, another MFC program?

thanx
0
Comment
Question by:_mentor
  • 2
4 Comments
 

Author Comment

by:_mentor
ID: 8115856
Help
0
 

Expert Comment

by:medhaonline
ID: 8116958
Hello mentor,

try using CSocket class.
0
 

Accepted Solution

by:
suganthkumar1 earned 200 total points
ID: 8125294
If your server is not a web server use CSocket class for connecing and sending the data.

CSocket oSocket;
if( oSocket.Create() )
{
    if( oSocket.Connect(<Host address>, <port number>) )
    {
       oSocket.Send(<data buffer>, length);
       ...........
    }
}


if you are connecting to a web server use CHTTPConnection class

CInternetSession oSession;
CHttpConnection *pConection = oSession.GetHttpConnection(Host, port);

if( pConnection != NULl )
{
 /// Send data using CHttpConnection
}



0
 

Author Comment

by:_mentor
ID: 11806129
Sorry about that i´ve not logged in here for a while and i forgot about this question.

regards,
mentor
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question