• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Stopping DataServer using socket connection

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings!
As part of the DataServer(rmi server) startup, it could create a ServerSocket and listen to it for shutdown command.
When user wants to shutdown the server, they will run DataServer with command line parameter "stop"; inside the program this will create a client Socket and connects to the ServerSocket created at the startup time. ServerSocket once gets the "stop" command, DataServer as a whole exits out.
Concern: I'm not sure, whether I can use "stop" as a command line parameter, as it's mentioned in the req, only listed parameters are allowed.
Am I allowed to do this?
I'd appreciate your help.
Thanks for your time!
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think the client should be able to shut down the server... On which grounds? How does the client know that no other clients are using the server? Do you think it is really the responsibility of a client to close the server? Server must only be shut down by an authorized administrator otherwise your application would be a chaos in the real-world...
 
Chandra Peri
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Valentin Crettaz:
I don't think the client should be able to shut down the server... On which grounds? How does the client know that no other clients are using the server? Do you think it is really the responsibility of a client to close the server? Server must only be shut down by an authorized administrator otherwise your application would be a chaos in the real-world...


I think I did not put my concern clearly. My mistake.
Actually, my implementation is rmi based. Clients have no idea about this socket. When the DataServer is started, along with regular rmi tasks, it also creates a ServerSocket in some other port and listens to it for shut down command. Again the same DataServer program has implementation to create a client Socket and to connect to the ServerSocket(with a different port than rmi communications port).
When the DataServer admin runs with command parameters like dns, port etc..(normal as in req) it starts the server and listens to client(rmi client ie the client gui) requests. When the admin wants to shut down the DataServer, he will run the same DataServer with stop as a command line parameter, this executes only the stopping part of DataServer implementation.
Hope I put it better now.

Thanks!
 
Chandra Peri
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm happy to provide more information about my implementation if anybody needed. I'd greatly appreciate your input.
Thanks!
(Note: Yes I wanted to bring this thread up in the list, so that somebody would take a look)
 
I don't always make ads but when I do they're tiny
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic