aspose file tools*
The moose likes Servlets and the fly likes Between java.net 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 java.net package or servlet class, which is better" Watch "Between java.net package or servlet class, which is better" New topic
Author

Between java.net 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 java.net package or servlet class, which one is better to implement?
Thanx in advance.
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
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
Hi,

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.
java.net 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.

Dani
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Between java.net package or servlet class, which is better