File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Between package or servlet class, which is better Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Between package or servlet class, which is better" Watch "Between package or servlet class, which is better" New topic

Between package or servlet class, which is better

Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
In my project, it has two servers named SMS-GW and CP. They communicate to each other by HTTP(s) socket. In CP server contains Tomcat, DBMS to provide a JSP Website (used the Struts Framwork, too :-). The SMS-GW server sends various parameters to the CP server through HTTP POST method.
I don't know between package or servlet class, which one is better to implement?
Thanx in advance.
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5382
If both server are using HTTP protocol for comminication .. IMO its better to implement in servlets.

"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Dani Mazzuca
Ranch Hand

Joined: May 21, 2003
Posts: 70

I didn't understand, but it seams that CP is a web applications (you mentioned Struts, database, etc), so in this case, your application shouls implement a servlet.
However, it seams to be that SMS-GW is only a client, that sends only request to CP. In this case, you don't need to write a servlet (with another tomcat installation). Just write a simple java aplication and use URL.getConnection() to send you data to the servlet. package has low level IP/TCP/UDP connection funtionality. You can also use it (class Socket) to let SMS-GW tcp-connect to you server via port 80, but I suggest to use URLConnection intead.

I agree. Here's the link:
subject: Between package or servlet class, which is better
It's not a secret anymore!