how can i simulate my pc as http server by writing java code to send the http response by socketstre

M

mike

my response as follows...


***************************************************
HTTP/1.1 200 OK
Date: Fri, 30 Oct 1999 14:39:30 GMT
Server: Apache/1.3.3 (Unix)
Cache-Control: max-age=3600, must-revalidate
Expires: Fri, 30 Oct 1999 15:40:00 GMT
Last-Modified: Mon, 29 Jun 1999 10:29:15 GMT
Etag: "3e86-410-3596fbbc"
Content-Length: 1040
Content-Type: text/html

HTML Document

****************************************************

how can i simulate my pc as http server by writing java code to send
the http response by socketstream to some pc in the internet?!

thanx
 
G

Gordon Beaton

my response as follows...

***************************************************
HTTP/1.1 200 OK
Date: Fri, 30 Oct 1999 14:39:30 GMT
Server: Apache/1.3.3 (Unix)
Cache-Control: max-age=3600, must-revalidate
Expires: Fri, 30 Oct 1999 15:40:00 GMT
Last-Modified: Mon, 29 Jun 1999 10:29:15 GMT
Etag: "3e86-410-3596fbbc"
Content-Length: 1040
Content-Type: text/html

HTML Document

****************************************************

how can i simulate my pc as http server by writing java code to send
the http response by socketstream to some pc in the internet?!

Open a ServerSocket to listen for connections on a suitable port,
usually port 80 but it really doesn't matter. Wait for a connection
from the client, read the client request. Send the response and
finally close the connection.

More or less.

Refer to rfc2616 (at www.ietf.org) for more details.

/gordon
 
M

mike

Gordon Beaton said:
Open a ServerSocket to listen for connections on a suitable port,
usually port 80 but it really doesn't matter. Wait for a connection
from the client, read the client request. Send the response and
finally close the connection.

More or less.

Refer to rfc2616 (at www.ietf.org) for more details.

/gordon
thanx...anyway...i have 3 machine A,B,C.....
B is java code executed machine

A ---B--- C

i write java code use 2 thread

thread 1:
A send request to B,and B forward request to C
C send response to B , i write java code to get the response ,
i get the response header and <html>....<\html>
and tranfer <html>....<\html> to Xhtml file....

i want to send the response header and Xhtml file to A (client)
how can i change the response header.....and response properly....
then let the client browser know the Xhtml content?!....


now i know maybe i should change the content-length response header


thanx
 
M

mike

regards:

I write java code to simulate my machine as a HTTP server,when client

connect to my HTTP server,my HTTP server replied client a xhtml file.

I use MS IE browser to test,MS IE test OK to read the xhtml file.

But when I use nokia 6600 to browse the file,nokia 6600 cannot browse

the xhtml file.why?.......Is something wrong with my idea?


any constructive suggestion is welcome


thank you
 
K

Keith M. Corbett

mike said:
regards:

I write java code to simulate my machine as a HTTP server,when client

connect to my HTTP server,my HTTP server replied client a xhtml file.

I use MS IE browser to test,MS IE test OK to read the xhtml file.

But when I use nokia 6600 to browse the file,nokia 6600 cannot browse

the xhtml file.why?.......Is something wrong with my idea?

What error do you get on the Nokia 6600?

Have you verified the Nokia can recognize and display XHTML files? (try
files on other servers)

Have you eliminated network issues as a possible source of your problem? Is
your server inside a firewall? (e.g. home or company network) In your
testing, did you run a client program (MS IE) on a remote host, ie. one not
local to the server? To verify that remote clients can connect to your
server, login to a remote host and run "telnet xxx 80" where xxx is your
server host and 80 is the HTTP server port.

/kmc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top