?
Solved

Connecting to a server from MFC program.

Posted on 2003-03-11
6
Medium Priority
?
189 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…

752 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