Originally posted by: amdfanboy
I have had this problem with other websites. Also, does anyone know how to get the request headers from the client? It always returns and says it has nothing to read.
This is the main class
Originally posted by: kamper
I must confess I understand very little of that. I haven't delved into any nio stuff. But I do understand the http half. At some point somewhere do you have a tcp Socket that is reading info in from the client? Where are you actually receiving some kind of a connection from the client and reading what it has to say?
HTTP/1.0 200 OK
Content-Type: text/html
Content-Length: 30
<center><b>Hello!</b></center>
Originally posted by: kamper
So you say:
telnet localhost xxxx
and then the headers come right back immediately? Or have you actually typed some request headers into telnet?
Originally posted by: kamper
So you either need to find a method that will block until there is input or you need to loop somehow until you have sufficient input (which isn't cool cuz you'd have to busy-wait). With traditional socket programming (tcp, anyways) you wrap a BufferedReader around a socket (with a few layers in between). Then you either do a readLine (blocks until you get a \n) or you grab character by character until you have everything you want. Either way, you need something that blocks until you have enough input to move forward.

 
				
		