Solved

MFC Socket/Java Servlet communication (How to?)

Posted on 2001-06-29
4
625 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
configuration management 2 100
xyBalance chalenge 58 88
Smart Camera scanning and reading information 3 86
mapAB Challlenge 35 85
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 video discusses moving either the default database or any database to a new volume.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now