"chamarthi vinod" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > please suggest better way or send some implementation code for the > following > : > > > 1. How the TCP/IP client request over a socket received at the tomcat? Is > there a configuration to specify the port on which TCP client has to send > the request? > > Or the client shall use the same 8080 port for connecting over TCP also? >
By convention, it is the 'port' attribute on the <Connector /> element. But this isn't inforced. > 2. Does container support TCP sockets typically or we need to configure ? > At the moment, Tomcat only works with TCP sockets ;). The question is the message protocol that is coming over the socket. Out-of-the-box, Tomcat only supports HTTP/1.1 and AJP/1.3 as messaging protocols. But there is nothing to stop anyone writing support for another. It looks like you are after a custom ProtocolHandler (see below), so http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/tomcat/util/net/PoolTcpEndpoint.html may provide the basic socket and thread handling you need to implement it (assuming you don't need to do fancy stuff like NIO). > 3. How tomcat interprets the tcp/ip socket message to a servletrequest and > servlet response object? > Tomcat uses the Coyote interfaces from: http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/coyote/package-summary.html to translate between tcp/ip socket (or any other transport protocol, for that matter) messages and Request/Response objects. Specifically it is the job of the ProtocolHandler to parse the incoming message into a Request/Response object pair, assign it to a thread, and hand it back to the Adapter to get sent to the target Servlet. You tell Tomcat to use your ProtocolHandler via <Connector protocol="com.myfirm.mypackage.MyProtocolHandler" ... />. All other attributes on the <Connector /> element will get passed through to the instance of MyProtocolHandler, so you can have any configuration directives that you like. > 4. If possible please provide the sample code for the above ? > Starting with org.apache.coyote.ajp.AjpProtocol (in TC 6.x) is probably the simplest tcp/ip example. (MemoryProtocolHandler is simpiler, but it doesn't do tcp/ip, so it is mostly useful as a mock Connector for unit testing Embedded Tomcats). There is also org.apache.coyote.http11.Http11Protocol, which is more complicated since HTTP/1.1 is a more complicated protocol than AJP/1.3 :). > Thanks in Advance. > > Vinod. > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]