Results 1 to 5 of 5
  1. #1
    anthropamorphic's Avatar
    anthropamorphic is offline Senior Member
    Join Date
    Jun 2011
    Posts
    135
    Rep Power
    0

    Default Problems with HTTP GET

    Hello JavaForums,
    I'm currently working on an http java api, and yes I know one already exists. That being said, I'm running into problems where the network is timing out. I've never directly written HTTP methods before, so I believe the problem lies within my GET request and not in the java code itself.

    Here is the console information:

    Java Code:
    [http.TCPClient]: connecting to - [128.30.52.37, 80]
    [http.TCPClient]: Connection established.
    [http.TCPClient]: Listener running.
    [http.TCPClient]: sent: 
    GET /Protocols/HTTP/HTRQ_Headers.html HTTP/1.0
    Accept: text/html
    User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.73.11 (KHTML, like Gecko) Version/7.0.1 Safari/537.73.11
    
    [Recieved Packet | Lines = 8]
    HTTP/1.0 408 Request Time-out
    Cache-Control: no-cache
    Connection: close
    Content-Type: text/html
    
    <html><body><h1>408 Request Time-out</h1>
    Your browser didn't send a complete request in time.
    </body></html>
    For some reason the server is taking way too long to reply. It usually takes around 10 or 15 seconds to get a response. Again I believe the error is in my GET request, but it's been a while since I've needed to write a TCP client, so if anyone wants the code I can submit parts of it as well.
    Last edited by anthropamorphic; 04-15-2014 at 02:44 PM.

  2. #2
    anthropamorphic's Avatar
    anthropamorphic is offline Senior Member
    Join Date
    Jun 2011
    Posts
    135
    Rep Power
    0

    Default Re: Problems with HTTP GET

    The problem's in my send method, I'm fixing it now, so I'll problem just delete this thread.

  3. #3
    anthropamorphic's Avatar
    anthropamorphic is offline Senior Member
    Join Date
    Jun 2011
    Posts
    135
    Rep Power
    0

    Default Re: Problems with HTTP GET

    The problem was I needed to use the "println" method instead of the "write" method in the PrintWriter class. I'll leave this thread open just incase anyone else faces a similar problem.

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,741
    Rep Power
    5

    Default Re: Problems with HTTP GET

    You can't delete it yourself anyway ;)
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    anthropamorphic's Avatar
    anthropamorphic is offline Senior Member
    Join Date
    Jun 2011
    Posts
    135
    Rep Power
    0

    Default Re: Problems with HTTP GET

    Quote Originally Posted by gimbal2 View Post
    You can't delete it yourself anyway ;)
    Oh hahaha, well problem solved then.

Similar Threads

  1. Replies: 3
    Last Post: 10-15-2012, 11:53 AM
  2. Replies: 16
    Last Post: 09-25-2011, 10:01 PM
  3. Replies: 7
    Last Post: 11-11-2009, 08:29 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •