You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tim Judd <tj...@yahoo.com> on 2011/07/01 01:14:12 UTC

webapps and TCP/UDP listening sockets

I think this would be probably difficult to Google and get answers, so I joined 
the mailing list hoping I might get a straight answer...

If I develop a webapp that listens for TCP/UDP sockets, which machine is 
actually listening?  Is the tomcat server listening (because the webapp is 
running on that tomcat) or is the client listening (because he is running the 
webapp on the tomcat server)!

My goal is to have:
  single UDP listening at tomcat server for packets, and
  multicast UDP listening at the clients that is getting resended off the single 
above UDP port from the webapp tomcat server


This will eventually become a CRM and this mental block or potential problem may 
need me to re-evaluate how the tool is made.


 If opportunity doesn't knock, build a door.
"I can" is a way of life.
More and Bigger is not always Better.
The road to success is always uphill.

Re: webapps and TCP/UDP listening sockets

Posted by Tim Judd <tj...@yahoo.com>.
David,

Thank you loads.  :)



 If opportunity doesn't knock, build a door.
"I can" is a way of life.
More and Bigger is not always Better.
The road to success is always uphill.




________________________________
From: David kerber <dc...@verizon.net>
To: Tomcat Users List <us...@tomcat.apache.org>
Sent: Fri, July 1, 2011 9:03:58 AM
Subject: Re: webapps and TCP/UDP listening sockets

On 6/30/2011 11:45 PM, Tim Judd wrote:
> Hi Christopher, all
>
> 'machine' was meant to indicate one of two choices, the computer that is 
>running
> the tomcat server, or the computer who is the client in a client-server
> relationship.  I don't know the intricities of webapps yet in how they run.
> This thread was just trying to understand if I'm barking up the wrong tree.
>
> Your second paragraph is better phrased.  which computer/'machine' is doing 
the
> binding?  Writing a standalone Java desktop app is most definately going to 
>bind
> to it's own machine.  I don't need to delegate anything to Tomcat itself, I 
>need
> to know if I run a webapp and it binds and listens to a socket, which machine
> does it bind on?

A Webapp by definition runs in tomcat, and will bind on the server.  I 
don't know anything about x11, but if it's similar to Citrix or 
Microsoft RDP, then even a local java app is going to be actually 
running on the server (and therefore binding the sockets there), and 
only sending the console to your client.


>
>
> Lastly, your statement about making it a webapp if http is not involved is
> because to centrally deploy an application is often served off http; I wanted 
>to
> get into Java/webapps so I elected this route.  If they are standalone 
>protocols
> (and they will be) to communicate between many clients to one (or a farm) of
> servers, why can't I launch it from http?
>
>
>   If opportunity doesn't knock, build a door.
> "I can" is a way of life.
> More and Bigger is not always Better.
> The road to success is always uphill.
>
>
>
>
> ________________________________
> From: Christopher Schultz<ch...@christopherschultz.net>
> To: Tomcat Users List<us...@tomcat.apache.org>
> Sent: Thu, June 30, 2011 8:07:55 PM
> Subject: Re: webapps and TCP/UDP listening sockets
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Tim,
>
> On 6/30/2011 7:14 PM, Tim Judd wrote:
>> If I develop a webapp that listens for TCP/UDP sockets, which machine is
>> actually listening?
>
> When you say "machine"... you mean ... what, exactly?
>
> If you develop a webapp that listens for TCP/UDP sockets, where is the
> socket bind occurring? If it's your webapp, then it really has nothing
> to do with Tomcat at all: it's just like writing a non-webapp program
> that binds to a socket and listens.
>
> If you want to delegate incoming requests to threads from Tomcat's
> request processor pool, that might be a bit tricky. Is that what you'd
> like to do?
>
> Do you really need Tomcat in this situation?
>
>> Is the tomcat server listening (because the webapp is
>> running on that tomcat) or is the client listening (because he is running the
>> webapp on the tomcat server)!
>
> Probably both, but it depends on your answer to the above questions.
>
>> My goal is to have:
>>    single UDP listening at tomcat server for packets, and
>>    multicast UDP listening at the clients that is getting resended off the
>> single
>>
>> above UDP port from the webapp tomcat server
>
> Why do you want to build this as a web-based application if HTTP isn't
> really involved?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk4NK/sACgkQ9CaO5/Lv0PBlLwCaAqi72qyRX1HCwlrtor+NS62X
> YiQAoLuYcbXt4tp9oQ0B+hTCqaocDbkG
> =QlO7
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


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

RE: [OT] webapps and TCP/UDP listening sockets

Posted by Jeffrey Janner <Je...@PolyDyne.com>.
> From: Christopher Schultz 
>
> David,
> 
> On 7/1/2011 11:03 AM, David kerber wrote:
> > I don't know anything about x11, but if it's similar to Citrix or
> > Microsoft RDP
> 
> No, it's Citrix and RDP that are like X11 :)
> 

That might be true for Citrix, but I know of no way to run 5 apps, each from a different server, on one client desktop using RDP.
__________________________________________________________________________

Confidentiality Notice:  This Transmission (including any attachments) may contain information that is privileged, confidential, and exempt from disclosure under applicable law.  If the reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited.  

If you have received this transmission in error, please immediately reply to the sender or telephone (512) 343-9100 and delete this transmission from your system.

Re: [OT] webapps and TCP/UDP listening sockets

Posted by David kerber <dc...@verizon.net>.
On 7/1/2011 2:39 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> David,
>
> On 7/1/2011 11:03 AM, David kerber wrote:
>> I don't know anything about x11, but if it's similar to Citrix or
>> Microsoft RDP
>
> No, it's Citrix and RDP that are like X11 :)

Like I said, I know nothing about X11!!


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


Re: [OT] webapps and TCP/UDP listening sockets

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

David,

On 7/1/2011 11:03 AM, David kerber wrote:
> I don't know anything about x11, but if it's similar to Citrix or 
> Microsoft RDP

No, it's Citrix and RDP that are like X11 :)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4OFF8ACgkQ9CaO5/Lv0PBPCwCeIHfsuGyFfBDfKkDDqDEXM4vy
im8AoJVw1gMuMEN7ISBZZUayudvXeB3m
=mWsT
-----END PGP SIGNATURE-----

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


Re: webapps and TCP/UDP listening sockets

Posted by David kerber <dc...@verizon.net>.
On 6/30/2011 11:45 PM, Tim Judd wrote:
> Hi Christopher, all
>
> 'machine' was meant to indicate one of two choices, the computer that is running
> the tomcat server, or the computer who is the client in a client-server
> relationship.  I don't know the intricities of webapps yet in how they run.
> This thread was just trying to understand if I'm barking up the wrong tree.
>
> Your second paragraph is better phrased.  which computer/'machine' is doing the
> binding?  Writing a standalone Java desktop app is most definately going to bind
> to it's own machine.  I don't need to delegate anything to Tomcat itself, I need
> to know if I run a webapp and it binds and listens to a socket, which machine
> does it bind on?

A Webapp by definition runs in tomcat, and will bind on the server.  I 
don't know anything about x11, but if it's similar to Citrix or 
Microsoft RDP, then even a local java app is going to be actually 
running on the server (and therefore binding the sockets there), and 
only sending the console to your client.


>
>
> Lastly, your statement about making it a webapp if http is not involved is
> because to centrally deploy an application is often served off http; I wanted to
> get into Java/webapps so I elected this route.  If they are standalone protocols
> (and they will be) to communicate between many clients to one (or a farm) of
> servers, why can't I launch it from http?
>
>
>   If opportunity doesn't knock, build a door.
> "I can" is a way of life.
> More and Bigger is not always Better.
> The road to success is always uphill.
>
>
>
>
> ________________________________
> From: Christopher Schultz<ch...@christopherschultz.net>
> To: Tomcat Users List<us...@tomcat.apache.org>
> Sent: Thu, June 30, 2011 8:07:55 PM
> Subject: Re: webapps and TCP/UDP listening sockets
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Tim,
>
> On 6/30/2011 7:14 PM, Tim Judd wrote:
>> If I develop a webapp that listens for TCP/UDP sockets, which machine is
>> actually listening?
>
> When you say "machine"... you mean ... what, exactly?
>
> If you develop a webapp that listens for TCP/UDP sockets, where is the
> socket bind occurring? If it's your webapp, then it really has nothing
> to do with Tomcat at all: it's just like writing a non-webapp program
> that binds to a socket and listens.
>
> If you want to delegate incoming requests to threads from Tomcat's
> request processor pool, that might be a bit tricky. Is that what you'd
> like to do?
>
> Do you really need Tomcat in this situation?
>
>> Is the tomcat server listening (because the webapp is
>> running on that tomcat) or is the client listening (because he is running the
>> webapp on the tomcat server)!
>
> Probably both, but it depends on your answer to the above questions.
>
>> My goal is to have:
>>    single UDP listening at tomcat server for packets, and
>>    multicast UDP listening at the clients that is getting resended off the
>> single
>>
>> above UDP port from the webapp tomcat server
>
> Why do you want to build this as a web-based application if HTTP isn't
> really involved?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk4NK/sACgkQ9CaO5/Lv0PBlLwCaAqi72qyRX1HCwlrtor+NS62X
> YiQAoLuYcbXt4tp9oQ0B+hTCqaocDbkG
> =QlO7
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


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


Re: webapps and TCP/UDP listening sockets

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

Tim,

On 7/1/2011 10:52 AM, Tim Judd wrote:
> I understand you guys are trying to help, but I am disappointed all I'm hearing 
> is "you're doing it wrong" basically.

You're reading it wrong: I was asking "what are you doing?" not telling
you that you are doing it wrong.

> I was hoping a quick answer to know which 
> machine is executing the code which would be the same side that has it bound.

The machine where you launch the program is the machine that executes
the code. That's pretty universal, you just need to understand the code
you're talking about.

In your Citrix example, you run the Citrix client on (let's say) your
home computer, and that code continues to run there pretty much for all
time (until you terminate the program). If that program runs /another/
program remotely and displays the contents, then the remote program has
always been remote and you are just being allowed to interact with it at
a distance.

> Does anyone know which machine will bind?

If you are running a webapp, the servlet container will always bind on
the server and a traditional webapp never binds to anything at all: the
container (Tomcat in this case) handles everything.

If you write a program to call-up a web server and request information,
your client program will bind to whatever machine it runs on (your home
computer perhaps) and the two programs exchange information over the wire.

You can't run a program on one machine that binds to a port on another
machine, at least without some super-special black magic going on.

If you write a web application that creates it's own sockets (which is
what we're saying doesn't make any sense to do, but it's hard to tell
what on earth you're talking about in the first place), they will bind
on the server, never the client.

Does that clear anything up?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4OEzEACgkQ9CaO5/Lv0PBdRwCglxGxEUtNGQyM4e78TyxB4o+x
JuIAnikPTGtj9VyG6CMpIgliu67+VIvp
=aIQI
-----END PGP SIGNATURE-----

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


Re: webapps and TCP/UDP listening sockets

Posted by Mark Eggers <it...@yahoo.com>.
----- Original Message -----

> From: Tim Judd <tj...@yahoo.com>
> To: Tomcat Users List <us...@tomcat.apache.org>
> Cc: 
> Sent: Friday, July 1, 2011 7:52 AM
> Subject: Re: webapps and TCP/UDP listening sockets
> 
> Hi Pid, all
> 
> I'm disappointed the responses I've gotten seemingly to be scolding 
> messages.  I 
> am reading up on documentation, I am reading the APIs, I am reading everything I 
> 
> can.  Think of Citrix (in Windows environments) - code is executed on the server 
> 
> and displayed on your desktop; X11 forwarding does the same thing.  I don't 
> know 
> which machine is executing the code
> 
> I understand you guys are trying to help, but I am disappointed all I'm 
> hearing 
> is "you're doing it wrong" basically.  I was hoping a quick answer 
> to know which 
> machine is executing the code which would be the same side that has it bound.
> 
> 
> Does anyone know which machine will bind?


I don't think anyone is trying to scold you as such. Some people may be wondering why Tomcat is involved with this is all.

That being said, I've written a rather lengthy response to your question. OK, I hope it's a proper response.

The first part covers (briefly) running a network server under Tomcat. The second part covers an idea (alternative approach) that would actually leverage Tomcat's capabilities. I hope this is useful.

Hopefully this is not off the mark.

Here's my understanding of the problem and your solution.

1. Deploy a client-server CRM software package
2. CRM has both point to point and broadcast requirements
3. Centrally deployed server
4. Potentially load-balanced farm of servers

You have tentatively decided on approaching requirement 2 with a
custom UDP and multicast protocol.

You are asking if you can leverage Tomcat (or maybe another servlet
container) to help with communications, deployment, and resiliency of
your solution.

The short answer is probably not, not without a lot of work.

I think the best that you're going to achieve with Tomcat is something
like what Derby does with its derby.war implementation.

Apache Derby comes with a war file that allows you to run a networked
derby database from within Tomcat. This war file provides a command /
control / monitoring interface for the Derby database. This interface
is accessible through Tomcat.

However, Tomcat does not provide the network connection for the actual
database and its clients. This is provided by the network Derby
server, which listens on TCP port 1527 (by default).

The database communication is under complete control of the Derby
network server, and does not use Tomcat resources.

You can accomplish this for your system. You should look at the source
code for the derby.war file to see how the command / control /
monitoring interface is built.

However, I don't think this is all that you want to accomplish.

Now we get to the architecture of your system. If you wish to leverage
Tomcat's resources, then there are several ways of going about
it. Talking off the top of my head, here are some ideas.

1. Use Tomcat 7.0.x

This will allow you to use asynchronous servlets. Coupled with AJAX,
you can then broadcast messages to all waiting clients. With Tomcat
6.0.x, there was a container-specific way of accomplishing this (with
Comet).

2. Use AJAX or AJAX / JSON for normal data communications

This is independent of what server you use (could be Tomcat, Apache
HTTPD, IIS, etc.) or language (Java, Perl, PHP, C#, etc.). This will
make your application more "lively". There are security considerations
when doing this, so please research carefully.

3. Desktop application

There's no reason why a platform communicating via HTTP has to be a
web browser. You could write a client in JavaFX (for example) to
interact with the server portion of your application.

In order to go this route (Tomcat, HTTP, asynchronous servlets, AJAX,
JSON), you will have to do some research.

Before diving into the servlet 3.0 specifications and asynchronous
servlets, I recommend getting your feet wet with some basic
concepts. A good book for doing that is:

Head First Servlets and JSP

There's also an AJAX book in the same vein.

Head Rush Ajax

Neither of these books serve as complete references, but they do
introduce you to the concepts necessary for building what I think
you're trying to accomplish.

Once you've wrapped your head around the concepts in these books, then
you would benefit from reading the servlet specification (sounds like
3.0 will fit your requirements as I understand them).

You'll probably want to have your application interact with a
database as well. In that case, Hibernate may be a good fit. There are
several books on that, as well as a Tomcat Wiki article on how to get
Hibernate to work with Tomcat's database pooling mechanism.

Hopefully, this has been useful. I apologize if I'm completely off
base here.

. . . . just my two cents.

/mde/


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


Re: webapps and TCP/UDP listening sockets

Posted by André Warnier <aw...@ice-sa.com>.
Tim Judd wrote:
> Hi Pid, all
> 
> I'm disappointed the responses I've gotten seemingly to be scolding messages.  I 
> am reading up on documentation, I am reading the APIs, I am reading everything I 
> can.  Think of Citrix (in Windows environments) - code is executed on the server 
> and displayed on your desktop; X11 forwarding does the same thing.  I don't know 
> which machine is executing the code
> 
> I understand you guys are trying to help, but I am disappointed all I'm hearing 
> is "you're doing it wrong" basically.  I was hoping a quick answer to know which 
> machine is executing the code which would be the same side that has it bound.
> 
> 
> Does anyone know which machine will bind?
> 
You are not being scolded, you are being pointed to sources of information about TCP/IP 
which may help you phrase your questions in a way that people here may have an easier time 
understanding and answering.
Nobody really feels like re-writing what these articles already explain at length, and 
which has basically nothing to do with helping people with Tomcat, which is what the 
helping souls on this forum are trying to do.

Not because you are - wrongly - complaining, but because it may avoid other people wasting 
their time, here is a brief overview :

- a socket is a OS-level structure which represents a "network channel" between 2 
applications (possibly on different computers)
- there are 2 types of sockets :
   - a "server" (or "listening") socket
   - a "client" socket
- the terms "bind" or "binding" are used only with the "server" type of socket
- an application can request from the OS to allocate (or "open") a socket for it, and when 
it does that, it specifies if it wants a "server" or "client" socket.
If the requested socket is of the "server" type, then the action of requesting this socket 
may be called "binding".
- a server socket is "passive" : it sits there, waiting for connections to it.  When it 
receives a connection, it informs the application that is "bound" to it. This server 
application can then read what the other party (a client) sent to this socket, and respond 
over the same socket.
- a client socket's purpose is usually to be used to "connect" to a distant server socket.
Normally the purpose is to allow the application which owns the client socket, to send 
some request or message to the application which is bound to the server socket (which is 
at the other end of the link), and to receive a response over that same channel and socket.
- all the above is true for TCP, and a bit less so for UDP.
- and finally, no matter what type of socket we are talking about, when an application 
asks the OS to create (open) a socket for it, it is always on the same server where this 
application runs.  So an application running on server A, can only bind to or open a 
socket on server A.

Do you understand now why your questions are a bit confusing ?

Just quoting one of them :
"If I develop a webapp that listens for TCP/UDP sockets, which machine is
  actually listening?"

Hopefully, the above makes clear that an application does not "listen for sockets", and 
why everyone here is a bit uncertain about what to answer.

And a webapp usually does not open any kind of socket, since it (indirectly) receives 
requests and sends responses through Tomcat (which does own sockets for that).
A webapp could open a separate client socket, but it would only do that if it wanted 
itself to talk, as a client, to some separate server application somewhere.






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


Re: webapps and TCP/UDP listening sockets

Posted by Tim Judd <tj...@yahoo.com>.
Hi Pid, all

I'm disappointed the responses I've gotten seemingly to be scolding messages.  I 
am reading up on documentation, I am reading the APIs, I am reading everything I 
can.  Think of Citrix (in Windows environments) - code is executed on the server 
and displayed on your desktop; X11 forwarding does the same thing.  I don't know 
which machine is executing the code

I understand you guys are trying to help, but I am disappointed all I'm hearing 
is "you're doing it wrong" basically.  I was hoping a quick answer to know which 
machine is executing the code which would be the same side that has it bound.


Does anyone know which machine will bind?




Thanks again!

 If opportunity doesn't knock, build a door.
"I can" is a way of life.
More and Bigger is not always Better.
The road to success is always uphill.




________________________________
From: Pid <pi...@pidster.com>
To: Tomcat Users List <us...@tomcat.apache.org>
Sent: Fri, July 1, 2011 4:39:10 AM
Subject: Re: webapps and TCP/UDP listening sockets

On 01/07/2011 04:45, Tim Judd wrote:
> Hi Christopher, all
> 
> 'machine' was meant to indicate one of two choices, the computer that is 
>running 
>
> the tomcat server, or the computer who is the client in a client-server 
> relationship.  

So you meant the client or the server.

> I don't know the intricities of webapps yet in how they run.  

Probably a good idea to read up on that if you're going to build one.

> This thread was just trying to understand if I'm barking up the wrong tree.
> 
> Your second paragraph is better phrased.  which computer/'machine' is doing the 
>
> binding?  

Whichever one the code for creating a socket is running on.  When you
create a client socket it still uses a port local to the JVM you're
running the code in.


> Writing a standalone Java desktop app is most definately going to bind 
> to it's own machine.  I don't need to delegate anything to Tomcat itself, I 
>need 
>
> to know if I run a webapp and it binds and listens to a socket, which machine 
> does it bind on?

Some confusion here still, it's nothing to do with a webapp and entirely
to do with the location of the code.


> Lastly, your statement about making it a webapp if http is not involved is 
> because to centrally deploy an application is often served off http; I wanted 
>to 
>
> get into Java/webapps so I elected this route.

You want to get into webapps, so you're build an app which has nothing
to do with webapps?


> If they are standalone protocols 
> (and they will be) to communicate between many clients to one (or a farm) of 
> servers, why can't I launch it from http?

Why would you?  What does the servlet container offer that running the
code independantly doesn't?

You're not describing an application which uses the http connectors
provided by Tomcat to operate, you're just using Tomcat as a launch
wrapper for your app.


p



>  If opportunity doesn't knock, build a door.
> "I can" is a way of life.
> More and Bigger is not always Better.
> The road to success is always uphill.
> 
> 
> 
> 
> ________________________________
> From: Christopher Schultz <ch...@christopherschultz.net>
> To: Tomcat Users List <us...@tomcat.apache.org>
> Sent: Thu, June 30, 2011 8:07:55 PM
> Subject: Re: webapps and TCP/UDP listening sockets
> 
> Tim,
> 
> On 6/30/2011 7:14 PM, Tim Judd wrote:
>> If I develop a webapp that listens for TCP/UDP sockets, which machine is 
>> actually listening?
> 
> When you say "machine"... you mean ... what, exactly?
> 
> If you develop a webapp that listens for TCP/UDP sockets, where is the
> socket bind occurring? If it's your webapp, then it really has nothing
> to do with Tomcat at all: it's just like writing a non-webapp program
> that binds to a socket and listens.
> 
> If you want to delegate incoming requests to threads from Tomcat's
> request processor pool, that might be a bit tricky. Is that what you'd
> like to do?
> 
> Do you really need Tomcat in this situation?
> 
>> Is the tomcat server listening (because the webapp is 
>> running on that tomcat) or is the client listening (because he is running the 

>> webapp on the tomcat server)!
> 
> Probably both, but it depends on your answer to the above questions.
> 
>> My goal is to have:
>>   single UDP listening at tomcat server for packets, and
>>   multicast UDP listening at the clients that is getting resended off the 
>> single 
> 
>> above UDP port from the webapp tomcat server
> 
> Why do you want to build this as a web-based application if HTTP isn't
> really involved?
> 
> -chris

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

Re: webapps and TCP/UDP listening sockets

Posted by Pid <pi...@pidster.com>.
On 01/07/2011 04:45, Tim Judd wrote:
> Hi Christopher, all
> 
> 'machine' was meant to indicate one of two choices, the computer that is running 
> the tomcat server, or the computer who is the client in a client-server 
> relationship.  

So you meant the client or the server.

> I don't know the intricities of webapps yet in how they run.  

Probably a good idea to read up on that if you're going to build one.

> This thread was just trying to understand if I'm barking up the wrong tree.
> 
> Your second paragraph is better phrased.  which computer/'machine' is doing the 
> binding?  

Whichever one the code for creating a socket is running on.  When you
create a client socket it still uses a port local to the JVM you're
running the code in.


> Writing a standalone Java desktop app is most definately going to bind 
> to it's own machine.  I don't need to delegate anything to Tomcat itself, I need 
> to know if I run a webapp and it binds and listens to a socket, which machine 
> does it bind on?

Some confusion here still, it's nothing to do with a webapp and entirely
to do with the location of the code.


> Lastly, your statement about making it a webapp if http is not involved is 
> because to centrally deploy an application is often served off http; I wanted to 
> get into Java/webapps so I elected this route.

You want to get into webapps, so you're build an app which has nothing
to do with webapps?


> If they are standalone protocols 
> (and they will be) to communicate between many clients to one (or a farm) of 
> servers, why can't I launch it from http?

Why would you?  What does the servlet container offer that running the
code independantly doesn't?

You're not describing an application which uses the http connectors
provided by Tomcat to operate, you're just using Tomcat as a launch
wrapper for your app.


p



>  If opportunity doesn't knock, build a door.
> "I can" is a way of life.
> More and Bigger is not always Better.
> The road to success is always uphill.
> 
> 
> 
> 
> ________________________________
> From: Christopher Schultz <ch...@christopherschultz.net>
> To: Tomcat Users List <us...@tomcat.apache.org>
> Sent: Thu, June 30, 2011 8:07:55 PM
> Subject: Re: webapps and TCP/UDP listening sockets
> 
> Tim,
> 
> On 6/30/2011 7:14 PM, Tim Judd wrote:
>> If I develop a webapp that listens for TCP/UDP sockets, which machine is 
>> actually listening?
> 
> When you say "machine"... you mean ... what, exactly?
> 
> If you develop a webapp that listens for TCP/UDP sockets, where is the
> socket bind occurring? If it's your webapp, then it really has nothing
> to do with Tomcat at all: it's just like writing a non-webapp program
> that binds to a socket and listens.
> 
> If you want to delegate incoming requests to threads from Tomcat's
> request processor pool, that might be a bit tricky. Is that what you'd
> like to do?
> 
> Do you really need Tomcat in this situation?
> 
>> Is the tomcat server listening (because the webapp is 
>> running on that tomcat) or is the client listening (because he is running the 
>> webapp on the tomcat server)!
> 
> Probably both, but it depends on your answer to the above questions.
> 
>> My goal is to have:
>>   single UDP listening at tomcat server for packets, and
>>   multicast UDP listening at the clients that is getting resended off the 
>> single 
> 
>> above UDP port from the webapp tomcat server
> 
> Why do you want to build this as a web-based application if HTTP isn't
> really involved?
> 
> -chris

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



Re: webapps and TCP/UDP listening sockets

Posted by Tim Judd <tj...@yahoo.com>.
Hi Christopher, all

'machine' was meant to indicate one of two choices, the computer that is running 
the tomcat server, or the computer who is the client in a client-server 
relationship.  I don't know the intricities of webapps yet in how they run.  
This thread was just trying to understand if I'm barking up the wrong tree.

Your second paragraph is better phrased.  which computer/'machine' is doing the 
binding?  Writing a standalone Java desktop app is most definately going to bind 
to it's own machine.  I don't need to delegate anything to Tomcat itself, I need 
to know if I run a webapp and it binds and listens to a socket, which machine 
does it bind on?


Lastly, your statement about making it a webapp if http is not involved is 
because to centrally deploy an application is often served off http; I wanted to 
get into Java/webapps so I elected this route.  If they are standalone protocols 
(and they will be) to communicate between many clients to one (or a farm) of 
servers, why can't I launch it from http?


 If opportunity doesn't knock, build a door.
"I can" is a way of life.
More and Bigger is not always Better.
The road to success is always uphill.




________________________________
From: Christopher Schultz <ch...@christopherschultz.net>
To: Tomcat Users List <us...@tomcat.apache.org>
Sent: Thu, June 30, 2011 8:07:55 PM
Subject: Re: webapps and TCP/UDP listening sockets

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tim,

On 6/30/2011 7:14 PM, Tim Judd wrote:
> If I develop a webapp that listens for TCP/UDP sockets, which machine is 
> actually listening?

When you say "machine"... you mean ... what, exactly?

If you develop a webapp that listens for TCP/UDP sockets, where is the
socket bind occurring? If it's your webapp, then it really has nothing
to do with Tomcat at all: it's just like writing a non-webapp program
that binds to a socket and listens.

If you want to delegate incoming requests to threads from Tomcat's
request processor pool, that might be a bit tricky. Is that what you'd
like to do?

Do you really need Tomcat in this situation?

> Is the tomcat server listening (because the webapp is 
> running on that tomcat) or is the client listening (because he is running the 
> webapp on the tomcat server)!

Probably both, but it depends on your answer to the above questions.

> My goal is to have:
>   single UDP listening at tomcat server for packets, and
>   multicast UDP listening at the clients that is getting resended off the 
>single 
>
> above UDP port from the webapp tomcat server

Why do you want to build this as a web-based application if HTTP isn't
really involved?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4NK/sACgkQ9CaO5/Lv0PBlLwCaAqi72qyRX1HCwlrtor+NS62X
YiQAoLuYcbXt4tp9oQ0B+hTCqaocDbkG
=QlO7
-----END PGP SIGNATURE-----

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

Re: webapps and TCP/UDP listening sockets

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

Tim,

On 6/30/2011 7:14 PM, Tim Judd wrote:
> If I develop a webapp that listens for TCP/UDP sockets, which machine is 
> actually listening?

When you say "machine"... you mean ... what, exactly?

If you develop a webapp that listens for TCP/UDP sockets, where is the
socket bind occurring? If it's your webapp, then it really has nothing
to do with Tomcat at all: it's just like writing a non-webapp program
that binds to a socket and listens.

If you want to delegate incoming requests to threads from Tomcat's
request processor pool, that might be a bit tricky. Is that what you'd
like to do?

Do you really need Tomcat in this situation?

> Is the tomcat server listening (because the webapp is 
> running on that tomcat) or is the client listening (because he is running the 
> webapp on the tomcat server)!

Probably both, but it depends on your answer to the above questions.

> My goal is to have:
>   single UDP listening at tomcat server for packets, and
>   multicast UDP listening at the clients that is getting resended off the single 
> above UDP port from the webapp tomcat server

Why do you want to build this as a web-based application if HTTP isn't
really involved?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4NK/sACgkQ9CaO5/Lv0PBlLwCaAqi72qyRX1HCwlrtor+NS62X
YiQAoLuYcbXt4tp9oQ0B+hTCqaocDbkG
=QlO7
-----END PGP SIGNATURE-----

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