Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Telnet works but my java code does not!

Posted on 2008-10-29
6
Medium Priority
?
278 Views
Last Modified: 2013-12-29
Hi, I can get a response with Telnet, sending this,

GET /?hl=en_US&src=14&s=V84LsjuD5KnXVZRT9zOwV4j0trE
Host: 127.0.0.1:38847


and I get this

Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
HTTP/1.1 200 OK
Content-Type: text/html
Connection: close

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
.....

but my java code imitating it does not

        String urlStr = "http://127.0.0.1:38847/?hl=en_US&src=14&s=V84LsjuD5KnXVZRT9zOwV4j0trE";
        try {
            URL url = new URL(urlStr);            
            HttpURLConnection con = (HttpURLConnection) url.openConnection();
            con.setRequestProperty("Host", "127.0.0.1:38847");  
            con.connect();
            System.out.println(con.getResponseCode());
....
0
Comment
Question by:kerzner
  • 4
  • 2
6 Comments
 
LVL 5

Expert Comment

by:muktajindal
ID: 22839368
What is the error that the java code is throwing ?
0
 
LVL 1

Author Comment

by:kerzner
ID: 22845555
stream breaks unexpectedly and -1 is the number of bytes returned
0
 
LVL 1

Author Comment

by:kerzner
ID: 22873657
I am running telnet from java
it works

now my problem is that is works from my java program, but not when this same code is inside jboss
0
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!

 
LVL 5

Accepted Solution

by:
muktajindal earned 2000 total points
ID: 22873660
How did you resolve the Java error ?
What is the error with Jboss now ??
0
 
LVL 1

Author Comment

by:kerzner
ID: 22873678
I resolved the java errors by running telnet as process, giving it inputs and reading it outputs

from jboss, I get no output :)
0
 
LVL 1

Author Closing Comment

by:kerzner
ID: 31511549
needed to run JBoss in my account, not root
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

580 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