Solved

MFC Socket/Java Servlet communication (How to?)

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need to retreive data from .TFS file exported by DVR 8 177
cat dog challenge 18 124
noX challenge 17 91
Detect file exist or not 3 128
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.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

929 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

13 Experts available now in Live!

Get 1:1 Help Now