You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ah...@dgcs.gov.om on 2006/05/30 08:36:32 UTC
Socket Servlet using Tomcat 5.5.17
How i can let Tomcat 5.5.27 listen to any socket connection from the
client and handle it ??
Re: Socket Servlet using Tomcat 5.5.17
Posted by Mladen Adamovic <ad...@blic.net>.
Ahmed.AlGhafri@dgcs.gov.om wrote:
> I want Tomcat run this default
> servlet open once that socket connect to Tomcat
>
Do redirect from index.jsp to your servlet. Do something like :
<%
String redirectURL = "http://hostname.com/";
response.sendRedirect(redirectURL);
%>
p.s. you should learn English better and learn how to describe your problems more clearly.
--
Mladen Adamovic
http://home.blic.net/adamm http://www.shortopedia.com
http://www.froola.com http://www.online-utility.org
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Socket Servlet using Tomcat 5.5.17
Posted by Ah...@dgcs.gov.om.
I know that Tomcat's purpose is to listen for requests and pass them on to
the appropriately mapped servlet. But i want to use Tomcat's because i
will not need to code all the mutli-threading part of it. and if in the
future some of the client connect over HTTP, I will have no problem
handling them. My question is that can i Configure Tomcat to listen for a
generalize TCP connection or not ?? Is there special Connector can do
that for me ?
"Richard Mixon" <rn...@qwest.net>
31/05/2006 08:27
Please respond to
"Tomcat Users List" <us...@tomcat.apache.org>
To
"'Tomcat Users List'" <us...@tomcat.apache.org>
cc
Subject
RE: Socket Servlet using Tomcat 5.5.17
Tomcat's purpose is to listen for requests and pass them on to the
appropriately mapped servlet. Maybe you do not want to use Tomcat, but
instead roll your own server that simply listens on a particular port for
socket opens. But again, to do this well is not a trivial exercise.
The port you choose to have Tomcat listen on is configurable (the default
is
port 8080). But it still expects a well formed HTTP request to arrive.
That
said I do know that there are both HTTP and non-HTTP versions of the
Servlet
interface - maybe someone else can tell you how this might or might not
help
you cause Tomcat to listen for a generalize TCP connection.
HTH - Richard
-----Original Message-----
From: Ahmed.AlGhafri@dgcs.gov.om [mailto:Ahmed.AlGhafri@dgcs.gov.om]
Sent: Tuesday, May 30, 2006 8:55 PM
To: Tomcat Users List
Subject: Re: Socket Servlet using Tomcat 5.5.17
Hi David...
I didn't send a request to the servlet I am expecting the servlet to
execute
on socket open, for that i made my servlet in the Root (The default
one)...
I want once i connect using the host and port it execute my servlet...
David Smith <dn...@cornell.edu>
30/05/2006 15:04
Please respond to
"Tomcat Users List" <us...@tomcat.apache.org>
To
Tomcat Users List <us...@tomcat.apache.org>
cc
Subject
Re: Socket Servlet using Tomcat 5.5.17
Could you please clarify something for me? You say you expect the
servlet to run when the socket is opened. Did you send a request or are
you really expecting the servlet to execute on socket open? The servlet
won't be aware of the client until a request is made and tomcat has a
chance to route it to your servlet per the spec.
--David
Ahmed.AlGhafri@dgcs.gov.om wrote:
>My problem is that my servlet running at Tomcat 5.05.17 and my servlet is
>the default servlet, now i am trying to call this servlet by a Java
>program that open socket connection... I want Tomcat run this default
>servlet open once that socket connect to Tomcat
>
>
>
>
>Markus Schönhaber <ma...@schoenhaber.de>
>30/05/2006 11:35
>Please respond to
>"Tomcat Users List" <us...@tomcat.apache.org>
>
>
>To
>"Tomcat Users List" <us...@tomcat.apache.org>
>cc
>
>Subject
>Re: Socket Servlet using Tomcat 5.5.17
>
>
>
>
>
>
>Ahmed.AlGhafri@dgcs.gov.om wrote:
>
>
>>How i can let Tomcat 5.5.27 listen to any socket connection from the
>>client and handle it ??
>>
>>
>
>By starting it.
>
>If this answer doesn't seem helpful, you should propably explain a little
>more
>precisely what you are trying to achieve.
>
>Regards
> mks
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Socket Servlet using Tomcat 5.5.17
Posted by Richard Mixon <rn...@qwest.net>.
Tomcat's purpose is to listen for requests and pass them on to the
appropriately mapped servlet. Maybe you do not want to use Tomcat, but
instead roll your own server that simply listens on a particular port for
socket opens. But again, to do this well is not a trivial exercise.
The port you choose to have Tomcat listen on is configurable (the default is
port 8080). But it still expects a well formed HTTP request to arrive. That
said I do know that there are both HTTP and non-HTTP versions of the Servlet
interface - maybe someone else can tell you how this might or might not help
you cause Tomcat to listen for a generalize TCP connection.
HTH - Richard
-----Original Message-----
From: Ahmed.AlGhafri@dgcs.gov.om [mailto:Ahmed.AlGhafri@dgcs.gov.om]
Sent: Tuesday, May 30, 2006 8:55 PM
To: Tomcat Users List
Subject: Re: Socket Servlet using Tomcat 5.5.17
Hi David...
I didn't send a request to the servlet I am expecting the servlet to execute
on socket open, for that i made my servlet in the Root (The default one)...
I want once i connect using the host and port it execute my servlet...
David Smith <dn...@cornell.edu>
30/05/2006 15:04
Please respond to
"Tomcat Users List" <us...@tomcat.apache.org>
To
Tomcat Users List <us...@tomcat.apache.org>
cc
Subject
Re: Socket Servlet using Tomcat 5.5.17
Could you please clarify something for me? You say you expect the
servlet to run when the socket is opened. Did you send a request or are
you really expecting the servlet to execute on socket open? The servlet
won't be aware of the client until a request is made and tomcat has a
chance to route it to your servlet per the spec.
--David
Ahmed.AlGhafri@dgcs.gov.om wrote:
>My problem is that my servlet running at Tomcat 5.05.17 and my servlet is
>the default servlet, now i am trying to call this servlet by a Java
>program that open socket connection... I want Tomcat run this default
>servlet open once that socket connect to Tomcat
>
>
>
>
>Markus Schönhaber <ma...@schoenhaber.de>
>30/05/2006 11:35
>Please respond to
>"Tomcat Users List" <us...@tomcat.apache.org>
>
>
>To
>"Tomcat Users List" <us...@tomcat.apache.org>
>cc
>
>Subject
>Re: Socket Servlet using Tomcat 5.5.17
>
>
>
>
>
>
>Ahmed.AlGhafri@dgcs.gov.om wrote:
>
>
>>How i can let Tomcat 5.5.27 listen to any socket connection from the
>>client and handle it ??
>>
>>
>
>By starting it.
>
>If this answer doesn't seem helpful, you should propably explain a little
>more
>precisely what you are trying to achieve.
>
>Regards
> mks
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Socket Servlet using Tomcat 5.5.17
Posted by Ah...@dgcs.gov.om.
Hi David...
I didn't send a request to the servlet I am expecting the servlet to
execute on socket open, for that i made my servlet in the Root (The
default one)... I want once i connect using the host and port it execute
my servlet...
David Smith <dn...@cornell.edu>
30/05/2006 15:04
Please respond to
"Tomcat Users List" <us...@tomcat.apache.org>
To
Tomcat Users List <us...@tomcat.apache.org>
cc
Subject
Re: Socket Servlet using Tomcat 5.5.17
Could you please clarify something for me? You say you expect the
servlet to run when the socket is opened. Did you send a request or are
you really expecting the servlet to execute on socket open? The servlet
won't be aware of the client until a request is made and tomcat has a
chance to route it to your servlet per the spec.
--David
Ahmed.AlGhafri@dgcs.gov.om wrote:
>My problem is that my servlet running at Tomcat 5.05.17 and my servlet is
>the default servlet, now i am trying to call this servlet by a Java
>program that open socket connection... I want Tomcat run this default
>servlet open once that socket connect to Tomcat
>
>
>
>
>Markus Schönhaber <ma...@schoenhaber.de>
>30/05/2006 11:35
>Please respond to
>"Tomcat Users List" <us...@tomcat.apache.org>
>
>
>To
>"Tomcat Users List" <us...@tomcat.apache.org>
>cc
>
>Subject
>Re: Socket Servlet using Tomcat 5.5.17
>
>
>
>
>
>
>Ahmed.AlGhafri@dgcs.gov.om wrote:
>
>
>>How i can let Tomcat 5.5.27 listen to any socket connection from the
>>client and handle it ??
>>
>>
>
>By starting it.
>
>If this answer doesn't seem helpful, you should propably explain a little
>more
>precisely what you are trying to achieve.
>
>Regards
> mks
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Socket Servlet using Tomcat 5.5.17
Posted by David Smith <dn...@cornell.edu>.
Could you please clarify something for me? You say you expect the
servlet to run when the socket is opened. Did you send a request or are
you really expecting the servlet to execute on socket open? The servlet
won't be aware of the client until a request is made and tomcat has a
chance to route it to your servlet per the spec.
--David
Ahmed.AlGhafri@dgcs.gov.om wrote:
>My problem is that my servlet running at Tomcat 5.05.17 and my servlet is
>the default servlet, now i am trying to call this servlet by a Java
>program that open socket connection... I want Tomcat run this default
>servlet open once that socket connect to Tomcat
>
>
>
>
>Markus Schönhaber <ma...@schoenhaber.de>
>30/05/2006 11:35
>Please respond to
>"Tomcat Users List" <us...@tomcat.apache.org>
>
>
>To
>"Tomcat Users List" <us...@tomcat.apache.org>
>cc
>
>Subject
>Re: Socket Servlet using Tomcat 5.5.17
>
>
>
>
>
>
>Ahmed.AlGhafri@dgcs.gov.om wrote:
>
>
>>How i can let Tomcat 5.5.27 listen to any socket connection from the
>>client and handle it ??
>>
>>
>
>By starting it.
>
>If this answer doesn't seem helpful, you should propably explain a little
>more
>precisely what you are trying to achieve.
>
>Regards
> mks
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Socket Servlet using Tomcat 5.5.17
Posted by Ah...@dgcs.gov.om.
My problem is that my servlet running at Tomcat 5.05.17 and my servlet is
the default servlet, now i am trying to call this servlet by a Java
program that open socket connection... I want Tomcat run this default
servlet open once that socket connect to Tomcat
Markus Schönhaber <ma...@schoenhaber.de>
30/05/2006 11:35
Please respond to
"Tomcat Users List" <us...@tomcat.apache.org>
To
"Tomcat Users List" <us...@tomcat.apache.org>
cc
Subject
Re: Socket Servlet using Tomcat 5.5.17
Ahmed.AlGhafri@dgcs.gov.om wrote:
> How i can let Tomcat 5.5.27 listen to any socket connection from the
> client and handle it ??
By starting it.
If this answer doesn't seem helpful, you should propably explain a little
more
precisely what you are trying to achieve.
Regards
mks
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Socket Servlet using Tomcat 5.5.17
Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Ahmed.AlGhafri@dgcs.gov.om wrote:
> Yeah it dose work when i am accessing the Tomcat via the browser but i
> don't want to access it via the browser because somebody from different
> machine will send me a message via a socket connection and i want that
> servlet do the work once the socket connect to the Tomcat
If I understand correctly, you want Tomcat to execute your servlet when an TCP
connection is established - even before any data is transmitted (before the
request is made). AFAIK this won't work.
But I don't get the point why you want to avoid making a HTTP request. Your
program already establishes a TCP connection. Why don't you (or the somebody
from a different machine) simply send a string like
"GET / HTTP/1.0"
followed by two CRLFs over this connection?
You don't even need to code this manually if you use the URL/URLConnection
classes.
Regards
mks
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Socket Servlet using Tomcat 5.5.17
Posted by Ah...@dgcs.gov.om.
Hi mks
Yeah it dose work when i am accessing the Tomcat via the browser but i
don't want to access it via the browser because somebody from different
machine will send me a message via a socket connection and i want that
servlet do the work once the socket connect to the Tomcat
Markus Schönhaber <ma...@schoenhaber.de>
30/05/2006 14:18
Please respond to
"Tomcat Users List" <us...@tomcat.apache.org>
To
"Tomcat Users List" <us...@tomcat.apache.org>
cc
Subject
Re: Socket Servlet using Tomcat 5.5.17
Ahmed.AlGhafri@dgcs.gov.om wrote:
> My problem is that my servlet running at Tomcat 5.05.17 and my servlet
is
> the default servlet, now i am trying to call this servlet by a Java
> program that open socket connection... I want Tomcat run this default
> servlet once that socket connect to Tomcat... Now the connection is
done
> but Tomcat dose not show response
Does it work when you access Tomcat (same URL your Java program uses) via
the
browser?
Regards
mks
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Socket Servlet using Tomcat 5.5.17
Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Ahmed.AlGhafri@dgcs.gov.om wrote:
> My problem is that my servlet running at Tomcat 5.05.17 and my servlet is
> the default servlet, now i am trying to call this servlet by a Java
> program that open socket connection... I want Tomcat run this default
> servlet once that socket connect to Tomcat... Now the connection is done
> but Tomcat dose not show response
Does it work when you access Tomcat (same URL your Java program uses) via the
browser?
Regards
mks
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Socket Servlet using Tomcat 5.5.17
Posted by Ah...@dgcs.gov.om.
My problem is that my servlet running at Tomcat 5.05.17 and my servlet is
the default servlet, now i am trying to call this servlet by a Java
program that open socket connection... I want Tomcat run this default
servlet once that socket connect to Tomcat... Now the connection is done
but Tomcat dose not show response
Re: Socket Servlet using Tomcat 5.5.17
Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Ahmed.AlGhafri@dgcs.gov.om wrote:
> How i can let Tomcat 5.5.27 listen to any socket connection from the
> client and handle it ??
By starting it.
If this answer doesn't seem helpful, you should propably explain a little more
precisely what you are trying to achieve.
Regards
mks
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org