Solved

Sending Requests from an Java Standalone Application

Posted on 2002-05-31
3
177 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
V.simple question about Android packages and libraries 1 22
splitOdd10 challenge 5 108
how do i compare an object based on two fields 6 54
table example 4 29
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

822 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