Solved

MFC Socket/Java Servlet communication (How to?)

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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
Prevent this page from creating additional dialogs. 3 777
move a line in eclipse 3 111
withoutTen challenge 14 140
Windows shortcut location resolution on double click open 4 77
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

734 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