>>> Liwen Chen <[EMAIL PROTECTED]> 16-May-00 7:32:18 AM >>>

>I got a problem. It's some sense off-topic,
>but the problem comes out from a servlet problem.

This is on-topic. It's about servlets - that's the subject of
discussion here /8->


>Below is the problem:
>In servlet A, I open a socket connection to host H, where
>there is a servlet running as a server program. And I send
>something to that servlet. In host H, the servlet receive
>the information sent by A and process it. After that, write
>something back to A. Then A read the information from it and
>close the connection.

Ok... seems reasonable... you could probably do it easier with a
URLConnection though (since servlets can only be talked to over
HTTP).

>I implemented it and sometime encountered some io problem.
>Someone told me, I should open two socket connections,
>one for writing to host H, the other one for reading
>from H. Is it right? Do I need to do that? Is my way of
>communication correct?

No you don't need to do that.

Basically a servlet is just an object that recieves HTTP requests and
sends HTTP responses.

If you've got a problem it most likely will be the way that you send
the request. You must follow the HTTP spec and if you don't then the
communication won't work.

Check the HTTP spec for details, or alternately use URLConnection and
HttpURLConnection.


Nic Ferrier

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to