Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Sending Requests from an Java Standalone Application

Posted on 2002-05-31
3
Medium Priority
?
194 Views
Last Modified: 2012-05-04
hi

I have created a standalone application using java AWT.
From my java application i need to send a request to the server and getback the response from the server which will should send some content back.

The most important thing is
How to send a request from my application ?

Is there any solution, if anybody have tried do help me.

Thanks in advance.
0
Comment
Question by:ayeshanasreen
[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
3 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 7046691
 If you would like to use TCP/IP then open a socket connection to the server, send the data to the server and then read the response back.

  Hope it helps.
0
 
LVL 35

Expert Comment

by:girionis
ID: 7046693
 ...for more info on sockets/connections over TCP/IP and UDP/IP take a lookhere:

http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets.html

  Hope it helps.
0
 
LVL 9

Accepted Solution

by:
Venci75 earned 800 total points
ID: 7046737
if you have to send a request to http server - you can use URLConnection:

 
java.net.URL url = new java.net.URL("http://www.yahoo.com"); // the requested URL
java.net.URLConnection conn = url.openConnection();
//conn.setDoInput(true);
java.io.InputStream in = conn.getInputStream();
// then use in.read() methods to get the content of the response
 
0

Featured Post

Independent Software Vendors: 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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

610 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