You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jost Boekemeier <jo...@gmail.com> on 2012/12/01 14:16:15 UTC

tomcat 7 udp connector

Hello,

I am developing a JEE web application which has to handle HTTP, TCP and UDP
connections.

Can Tomcat >= 7 handle raw TCP and UDP connections? Are there extensions
(connectors?) available which can handle them?

*I am aware of mina.apache.org, and I can write my own socket server, so
please don't point me to these solutions. The requirement is a JEE (Tomcat)
web app.*


I think persistent TCP connections should easy to implement. But what about
UDP?


Any pointers welcome.


Regards,
Jost Bökemeier

Re: tomcat 7 udp connector

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jost,

On 12/2/12 1:04 AM, Jost Boekemeier wrote:
> I won't explain php Java bridge. It's just a library which requires
> a jee (tomcat) environment.
> 
> We currently have code, written in php, which comnunicates whith
> trackboxes (mostly systech "a1") via udp/tcp and Java clients via
> http;  in other words: we have a http server, written in php, which
> also accepts udp and tcp requests.
> 
> We want to replace our proprietary code with standard components.
> 
> Wer know that tomcat can handle http and tcp. But what's the best
> way to implement a udp listener? I guess I have to add a new
> connector.

There is no getting around that: you *will* need to implement your own
connector. Unfortunately, the existing connectors are all TCP-oriented
so you are very unlikely to be able to re-use the connector (and
protocol handler) base code that is used by the existing (BIO/NIO/APR)
connectors which all require a reliable channel.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlC8tFQACgkQ9CaO5/Lv0PDNVQCeIJ7eKwkmE4sZc7/wgL/g5k9Z
MfYAn1gie2DzObm8QobfH0XRDA9l6NSt
=QVoY
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re:[OT] tomcat 7 udp connector

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/2/12 1:04 AM, Jost Boekemeier wrote:
> I'm using gmail from android, which includes quoted text at the
> bottom.  So I don't have much control over the layout.

Sure you do. Scroll to the bottom of the message and tap after the
final text. Don't blame your tools.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlC8s0MACgkQ9CaO5/Lv0PCrYgCghOq6R6Lzg0US6D9oGKsCx7PB
hlIAni/VgzTbCucnljghdzVhpXWaZ5N3
=STJm
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat 7 udp connector

Posted by Jost Boekemeier <jo...@gmail.com>.
Hi Mark,

I'm using gmail from android, which includes quoted text at the bottom.  So
I don't have much control over the layout.

I won't explain php Java bridge. It's just a library which requires a jee
(tomcat) environment.

We currently have code, written in php, which comnunicates whith trackboxes
(mostly systech "a1") via udp/tcp and Java clients via http;  in other
words: we have a http server, written in php, which also accepts udp and
tcp requests.

We want to replace our proprietary code with standard components.

Wer know that tomcat can handle http and tcp. But what's the best way to
implement a udp listener? I guess I have to add a new connector.

Re: tomcat 7 udp connector

Posted by Mark Eggers <it...@yahoo.com>.
On 12/1/2012 1:15 PM, Jost Boekemeier wrote:
> Hi,
>
> I don't think tomcat is hard-wired the way you suggest.
>
> And the servlet spec doesn't require http. In the past I've written a
> servlet container which uses raw tcp instead of http.
>
> The tomcat jee container is needed by php java bridge to rund php code from
> Java.
>

Sigh, please don't top post. I almost missed the vital key.

See at the end of the message.

> Probably the tomcat dev ml is more appropriate.
> Am 01.12.2012 21:50 schrieb "Pid" <pi...@pidster.com>:
>
>> On 01/12/2012 17:22, Mark Eggers wrote:
>>> On 12/1/2012 5:16 AM, Jost Boekemeier wrote:
>>>> Hello,
>>>>
>>>> I am developing a JEE web application which has to handle HTTP, TCP
>>>> and UDP connections.
>>>>
>>>> Can Tomcat >= 7 handle raw TCP and UDP connections? Are there
>>>> extensions (connectors?) available which can handle them?
>>>>
>>>> *I am aware of mina.apache.org, and I can write my own socket server,
>>>> so please don't point me to these solutions. The requirement is a JEE
>>>> (Tomcat) web app.*
>>>>
>>>>
>>>> I think persistent TCP connections should easy to implement. But what
>>>> about UDP?
>>>>
>>>>
>>>> Any pointers welcome.
>>>>
>>>>
>>>> Regards, Jost Bökemeier
>>>>
>>>
>>> Jost,
>>>
>>> I wrote up a nice analysis of how you can accomplish your goals. Then I
>>> read the following lines:
>>>
>>>> *I am aware of mina.apache.org, and I can write my own socket server,
>>>> so please don't point me to these solutions. The requirement is a JEE
>>>> (Tomcat) web app.*
>>>
>>> I glanced at the Tomcat code, and it seems to be built in complete
>>> protocol stacks (HTTP, AJP, clustering). So without major Tomcat surgery
>>> I don't think so.
>>>
>>> I was thinking of a command and control application along with a
>>> stand-alone server, much like Derby has:
>>>
>>> http://db.apache.org/derby/docs/10.1/adminguide/cadminservlet98430.html
>>>
>>> However, the above constraint eliminates that approach.
>>>
>>> There are some really interesting hackish ways to approach this (JNDI
>>> beans for clients, ServletContextListener to start servers), but that's
>>> far off the beaten path.
>>>
>>> Maybe if you stepped back and wrote what you're trying to accomplish
>>> people can suggest some approaches.
>>>
>>> All of that is probably quite a bit off-topic from the mailing list.
>>
>> Well, that saves me some work.
>>
>> I'll just add the following: it's really important to comprehend that
>> Tomcat is a Servlet Container and by extension, to understand what a
>> Servlet Container is.
>>
>> Reading an appropriate version of the Servlet Specification is therefore
>> a good idea.
>>
>>
>> p

Jost,

You're the project admin (creator, lead developer) for PHP / Java bridge:

http://php-java-bridge.sourceforge.net/pjb/

So now I'm really confused.

Basically, I'm reading that you can drop your WAR file into Tomcat, add 
the appropriate PHP application, and everything just works. The code 
would either work with the PHP application residing within Tomcat, or 
the PHP application residing in an HTTP server and sending requests to 
Tomcat.

There are lots of interesting challenges in the documentation, but I 
won't dig into those right now.

So, maybe you can restate your question?

I guess you need a j-random style port in Tomcat to support the HTTP/XML 
communications between a web server and Apache Tomcat?

Since you are sending HTTP, why do you need a raw UDP or TCP socket when 
Tomcat has multiple HTTP connectors available (and you can run them on 
any port)?

. . . . confused
/mde/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat 7 udp connector

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pid,

On 12/1/12 8:13 PM, Pid wrote:
> On 01/12/2012 21:15, Jost Boekemeier wrote:
>> Hi,
>> 
>> I don't think tomcat is hard-wired the way you suggest.
> 
> [sigh] Suggest?
> 
> Tomcat, as does the Servlet Spec, focuses on web applications, ie
> ones served over HTTP.
> 
> The Connector implementations are configurable, but there is no
> UDP implementation shipped with Tomcat.  Nor is there a raw
> Servlet, TCP implementation.
> 
> 
>> And the servlet spec doesn't require http.
> 
> What a strange statement.
> 
> The javax.servlet.http package, (being part of the spec), does
> rather seem to focus on it and the 3.0 spec mentions HTTP on a
> fairly large number of it's pages.

To be fair, javax.servlet.Servlet does not require HTTP. Of course,
99% of the uses of a Java Servlet container are to serve HTTP requests.

On the other hand, ServletRequest and ServletResponse (even in their
non-HTTP flavors) are quite obviously set up to handle streaming,
bidirectional connections. Sure, one could use DatagramSocket under
the covers to implement something that looked like a streaming (and
reliable) connection to the client, but since the servlet spec does
not include any APIs for detecting/handling dropped packets, etc. it
really is an odd choice to implement a UDP-based servlet (at least
when using the spec definition of a servlet).

>> In the past I've written a servlet container which uses raw tcp
>> instead of http.

I'd be interested in the architecture of such a beast: using an
unreliable connection for binary and character streams via the servlet
APIs seems untenable. The only way I would think it could work is if
you simply ignored the unreliable nature of UDP and assumed that all
messages would be successfully received and no problems would arise.
In those cases where that's a good bet (for example, all communication
is on localhost or even a local network), the cost of using TCP seems
so small as to be not worth the development effort to support UDP.

>> Probably the tomcat dev ml is more appropriate.

The Tomcat devs are all active on this list. There is no need to post
over there quite yet.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlC8uQQACgkQ9CaO5/Lv0PC0rQCgqV7e2gptSn1Yo0gt9P9HSksr
bWUAnjqchRd1nQfb4CTTe01ON1xemaR4
=Maly
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: tomcat 7 udp connector

Posted by Pid <pi...@pidster.com>.
On 01/12/2012 21:15, Jost Boekemeier wrote:
> Hi,
> 
> I don't think tomcat is hard-wired the way you suggest.

[sigh] Suggest?

Tomcat, as does the Servlet Spec, focuses on web applications, ie ones
served over HTTP.

The Connector implementations are configurable, but there is no UDP
implementation shipped with Tomcat.  Nor is there a raw Servlet, TCP
implementation.


> And the servlet spec doesn't require http. 

What a strange statement.

The javax.servlet.http package, (being part of the spec), does rather
seem to focus on it and the 3.0 spec mentions HTTP on a fairly large
number of it's pages.


> In the past I've written a
> servlet container which uses raw tcp instead of http.

Smashing.


> The tomcat jee container is needed by php java bridge to rund php code from
> Java.

Is that the context of your problem, or just some random info?


> Probably the tomcat dev ml is more appropriate.

Ahh, the dismissal.  Bueno.


p


> Am 01.12.2012 21:50 schrieb "Pid" <pi...@pidster.com>:
> 
>> On 01/12/2012 17:22, Mark Eggers wrote:
>>> On 12/1/2012 5:16 AM, Jost Boekemeier wrote:
>>>> Hello,
>>>>
>>>> I am developing a JEE web application which has to handle HTTP, TCP
>>>> and UDP connections.
>>>>
>>>> Can Tomcat >= 7 handle raw TCP and UDP connections? Are there
>>>> extensions (connectors?) available which can handle them?
>>>>
>>>> *I am aware of mina.apache.org, and I can write my own socket server,
>>>> so please don't point me to these solutions. The requirement is a JEE
>>>> (Tomcat) web app.*
>>>>
>>>>
>>>> I think persistent TCP connections should easy to implement. But what
>>>> about UDP?
>>>>
>>>>
>>>> Any pointers welcome.
>>>>
>>>>
>>>> Regards, Jost Bökemeier
>>>>
>>>
>>> Jost,
>>>
>>> I wrote up a nice analysis of how you can accomplish your goals. Then I
>>> read the following lines:
>>>
>>>> *I am aware of mina.apache.org, and I can write my own socket server,
>>>> so please don't point me to these solutions. The requirement is a JEE
>>>> (Tomcat) web app.*
>>>
>>> I glanced at the Tomcat code, and it seems to be built in complete
>>> protocol stacks (HTTP, AJP, clustering). So without major Tomcat surgery
>>> I don't think so.
>>>
>>> I was thinking of a command and control application along with a
>>> stand-alone server, much like Derby has:
>>>
>>> http://db.apache.org/derby/docs/10.1/adminguide/cadminservlet98430.html
>>>
>>> However, the above constraint eliminates that approach.
>>>
>>> There are some really interesting hackish ways to approach this (JNDI
>>> beans for clients, ServletContextListener to start servers), but that's
>>> far off the beaten path.
>>>
>>> Maybe if you stepped back and wrote what you're trying to accomplish
>>> people can suggest some approaches.
>>>
>>> All of that is probably quite a bit off-topic from the mailing list.
>>
>> Well, that saves me some work.
>>
>> I'll just add the following: it's really important to comprehend that
>> Tomcat is a Servlet Container and by extension, to understand what a
>> Servlet Container is.
>>
>> Reading an appropriate version of the Servlet Specification is therefore
>> a good idea.
>>
>>
>> p
>>
>>
>>
>>
>> --
>>
>> [key:62590808]
>>
>>
> 


-- 

[key:62590808]


Re: tomcat 7 udp connector

Posted by Jost Boekemeier <jo...@gmail.com>.
Hi,

I don't think tomcat is hard-wired the way you suggest.

And the servlet spec doesn't require http. In the past I've written a
servlet container which uses raw tcp instead of http.

The tomcat jee container is needed by php java bridge to rund php code from
Java.

Probably the tomcat dev ml is more appropriate.
Am 01.12.2012 21:50 schrieb "Pid" <pi...@pidster.com>:

> On 01/12/2012 17:22, Mark Eggers wrote:
> > On 12/1/2012 5:16 AM, Jost Boekemeier wrote:
> >> Hello,
> >>
> >> I am developing a JEE web application which has to handle HTTP, TCP
> >> and UDP connections.
> >>
> >> Can Tomcat >= 7 handle raw TCP and UDP connections? Are there
> >> extensions (connectors?) available which can handle them?
> >>
> >> *I am aware of mina.apache.org, and I can write my own socket server,
> >> so please don't point me to these solutions. The requirement is a JEE
> >> (Tomcat) web app.*
> >>
> >>
> >> I think persistent TCP connections should easy to implement. But what
> >> about UDP?
> >>
> >>
> >> Any pointers welcome.
> >>
> >>
> >> Regards, Jost Bökemeier
> >>
> >
> > Jost,
> >
> > I wrote up a nice analysis of how you can accomplish your goals. Then I
> > read the following lines:
> >
> >> *I am aware of mina.apache.org, and I can write my own socket server,
> >> so please don't point me to these solutions. The requirement is a JEE
> >> (Tomcat) web app.*
> >
> > I glanced at the Tomcat code, and it seems to be built in complete
> > protocol stacks (HTTP, AJP, clustering). So without major Tomcat surgery
> > I don't think so.
> >
> > I was thinking of a command and control application along with a
> > stand-alone server, much like Derby has:
> >
> > http://db.apache.org/derby/docs/10.1/adminguide/cadminservlet98430.html
> >
> > However, the above constraint eliminates that approach.
> >
> > There are some really interesting hackish ways to approach this (JNDI
> > beans for clients, ServletContextListener to start servers), but that's
> > far off the beaten path.
> >
> > Maybe if you stepped back and wrote what you're trying to accomplish
> > people can suggest some approaches.
> >
> > All of that is probably quite a bit off-topic from the mailing list.
>
> Well, that saves me some work.
>
> I'll just add the following: it's really important to comprehend that
> Tomcat is a Servlet Container and by extension, to understand what a
> Servlet Container is.
>
> Reading an appropriate version of the Servlet Specification is therefore
> a good idea.
>
>
> p
>
>
>
>
> --
>
> [key:62590808]
>
>

Re: tomcat 7 udp connector

Posted by Pid <pi...@pidster.com>.
On 01/12/2012 17:22, Mark Eggers wrote:
> On 12/1/2012 5:16 AM, Jost Boekemeier wrote:
>> Hello,
>>
>> I am developing a JEE web application which has to handle HTTP, TCP
>> and UDP connections.
>>
>> Can Tomcat >= 7 handle raw TCP and UDP connections? Are there
>> extensions (connectors?) available which can handle them?
>>
>> *I am aware of mina.apache.org, and I can write my own socket server,
>> so please don't point me to these solutions. The requirement is a JEE
>> (Tomcat) web app.*
>>
>>
>> I think persistent TCP connections should easy to implement. But what
>> about UDP?
>>
>>
>> Any pointers welcome.
>>
>>
>> Regards, Jost Bökemeier
>>
> 
> Jost,
> 
> I wrote up a nice analysis of how you can accomplish your goals. Then I
> read the following lines:
> 
>> *I am aware of mina.apache.org, and I can write my own socket server,
>> so please don't point me to these solutions. The requirement is a JEE
>> (Tomcat) web app.*
> 
> I glanced at the Tomcat code, and it seems to be built in complete
> protocol stacks (HTTP, AJP, clustering). So without major Tomcat surgery
> I don't think so.
> 
> I was thinking of a command and control application along with a
> stand-alone server, much like Derby has:
> 
> http://db.apache.org/derby/docs/10.1/adminguide/cadminservlet98430.html
> 
> However, the above constraint eliminates that approach.
> 
> There are some really interesting hackish ways to approach this (JNDI
> beans for clients, ServletContextListener to start servers), but that's
> far off the beaten path.
> 
> Maybe if you stepped back and wrote what you're trying to accomplish
> people can suggest some approaches.
> 
> All of that is probably quite a bit off-topic from the mailing list.

Well, that saves me some work.

I'll just add the following: it's really important to comprehend that
Tomcat is a Servlet Container and by extension, to understand what a
Servlet Container is.

Reading an appropriate version of the Servlet Specification is therefore
a good idea.


p




-- 

[key:62590808]


Re: tomcat 7 udp connector

Posted by Mark Eggers <it...@yahoo.com>.
On 12/1/2012 5:16 AM, Jost Boekemeier wrote:
> Hello,
>
> I am developing a JEE web application which has to handle HTTP, TCP
> and UDP connections.
>
> Can Tomcat >= 7 handle raw TCP and UDP connections? Are there
> extensions (connectors?) available which can handle them?
>
> *I am aware of mina.apache.org, and I can write my own socket server,
> so please don't point me to these solutions. The requirement is a JEE
> (Tomcat) web app.*
>
>
> I think persistent TCP connections should easy to implement. But what
> about UDP?
>
>
> Any pointers welcome.
>
>
> Regards, Jost Bökemeier
>

Jost,

I wrote up a nice analysis of how you can accomplish your goals. Then I 
read the following lines:

 > *I am aware of mina.apache.org, and I can write my own socket server,
 > so please don't point me to these solutions. The requirement is a JEE
 > (Tomcat) web app.*

I glanced at the Tomcat code, and it seems to be built in complete 
protocol stacks (HTTP, AJP, clustering). So without major Tomcat surgery 
I don't think so.

I was thinking of a command and control application along with a 
stand-alone server, much like Derby has:

http://db.apache.org/derby/docs/10.1/adminguide/cadminservlet98430.html

However, the above constraint eliminates that approach.

There are some really interesting hackish ways to approach this (JNDI 
beans for clients, ServletContextListener to start servers), but that's 
far off the beaten path.

Maybe if you stepped back and wrote what you're trying to accomplish 
people can suggest some approaches.

All of that is probably quite a bit off-topic from the mailing list.

. . . . just my two cents.
/mde/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org