<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Why don't you use one of the existing HTTP server implementations?<div><br></div><div>-kevin</div><div><br></div><div><br><div><div>On Feb 13, 2009, at 2:20 AM, Hynek Vychodil wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">You should make HTTP response but you have made raw response directly to socket.<br><br>Try this<br><br>gen_tcp:send(Socket, ["HTTP/1.0 200 OK\r\nContent-Type:text/plain\r\n\r\nI Received ", Data]),<br><br><div class="gmail_quote"> On Fri, Feb 13, 2009 at 10:22 AM, prasantha kumara <span dir="ltr"><<a href="mailto:jlprasantha@gmail.com">jlprasantha@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Hi all!<br> I am dealing with a erlang server which is accept http request from<br> other frramework.i have sent a request to the server. following is the<br> some code which i have used to do it.<br> <br> inet:setopts(Socket, [{active, once}]),<br> receive<br> % do something with the data you receive<br> {tcp, Socket, Data} -><br> gen_tcp:send(Socket, "I Received " ++ Data),<br> <br>  but when it is recieved from the java it gives following error.<br> <br> <br> The server 127.0.0.1 failed to respond with a valid HTTP response<br>        at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1846)<br>        at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)<br>        at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)<br>        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)<br>        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)<br>        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)<br>        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)<br>        at httpRequest.Test.main(Test.java:24)<br> <br> <br> Can any body help me to format the response correctly using erlang ?<br> <br> thanks<br> prasantha.<br> _______________________________________________<br> erlang-questions mailing list<br> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br> </blockquote></div><br><br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil<br><br>Analyze your data in minutes. Share your insights instantly. Thrill your boss.  Be a data hero!<br>Try Good Data now for free: <a href="http://www.gooddata.com">www.gooddata.com</a><br> _______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://www.erlang.org/mailman/listinfo/erlang-questions</blockquote></div><br></div></body></html>