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
Solved

Sending Requests from an Java Standalone Application

Posted on 2002-05-31
3
179 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
  • 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 200 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

808 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