Solved

MFC Socket/Java Servlet communication (How to?)

Posted on 2001-06-29
4
636 Views
Last Modified: 2013-11-20
Let's say that I have the servlet: http://localhost/servlet/MyServlet

with the following code:

...doGet...
ServletOutputStream cli=response.getOutputStream();
cli.println("SOME TEXT");
cli.close();

...doPost...
ServletOutputStream cli=response.getOutputStream();
cli.println("SOME TEXT");
cli.close();

How can I read the "SOME TEXT" text, from an MFC app? Can I do it using CSocket's? Do you have any piece of code?

No matter if it's Get or Post. I only need to comunicate an MFC app. with a servlet thru port 80, because the MFC app is under firewall.

Thanks in advance.
0
Comment
Question by:wau
[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
4 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 50 total points
ID: 6238939
Why don't you explain your environment a bit more?  

I'm somewhat confused over which context you are wanting to run this code in.  You start out referring to a servlet and servlet code which runs on the server but then jump into MFC code that seems to be running in the context of a client.  Are we talking a web browser environment or some sort of client software that runs like a web client?

If it's just straight MFC code that runs on the client and needs to connect to and receive some data from your servlet, the simplest way would be via the WinInet API.  InternetConnect() for instance will do nicely.  If you want to use MFC, the CInternetSession/CHttpConnection will also do but I think the code is a bit more complex.  Either will get the job done, however.
0
 
LVL 1

Expert Comment

by:raghurani
ID: 6810602
I am facing some problem when my java servlets communicate with my mfc server. server written in MFC uses CSockets, thus I had use a dll written in VC++ as a patch between java and mfc (of course, via JNI).

With this, java can communicate with the server. but, when the server sends data back to java, my dll seem to wait infinitely. Using tools like netstat I found that the data arrives at port where the dll is listening..

wanted to know if you have encountered any such problem?
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6827664
This question appears to have been abandoned. Your options are:
 
1.  Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3.  Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4.  Delete the question. Again, you must tell the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below, include the question QID/link.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this Help Desk link for Member Guidelines, Member Agreement and the Question/Answer process:  Click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues.
http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

 
PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:
 
Please leave any comments regarding this question here on closing recommendations if this item remains inactive another three days.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange
 
P.S.  For year 2000 question, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9490141
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by : jhance

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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 a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

705 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