Solved

Telnet works but my java code does not!

Posted on 2008-10-29
6
251 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
Comment Utility
What is the error that the java code is throwing ?
0
 
LVL 1

Author Comment

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

Author Comment

by:kerzner
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 5

Accepted Solution

by:
muktajindal earned 500 total points
Comment Utility
How did you resolve the Java error ?
What is the error with Jboss now ??
0
 
LVL 1

Author Comment

by:kerzner
Comment Utility
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
Comment Utility
needed to run JBoss in my account, not root
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
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 …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

728 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

9 Experts available now in Live!

Get 1:1 Help Now