-3

hey my main objective is to run a server on my linux system to which about 10 linux systems will be connected. So my motive is to program the server(in java) in order to find disk capacity of any desired system connected to the server. Is this possible?? I am using netbeans on ubuntu 11.10

Thank you in advance

Hans Z
  • 4,664
  • 2
  • 27
  • 50
Somye
  • 87
  • 5
  • 11
  • 1
    You can find out disk space client side and send a message to your main server. Check out this thread for more details http://stackoverflow.com/questions/1051295/how-to-find-how-much-disk-space-is-left-using-java – Hans Z Jun 11 '12 at 15:54
  • Which part are you asking? How to determine the disk capacity, or how to signal that to a server? – Paul Tomblin Jun 11 '12 at 16:04
  • See http://stackoverflow.com/questions/25552/using-java-to-get-os-level-system-information for how to determine the disk capacities. – Paul Tomblin Jun 11 '12 at 16:06

1 Answers1

1

Yes, this is possible. You can use Sockets to create a communication between your server and client systems, and the client sockets could write their disk capacity to the server socket.

To get a system's disk capacity, get the total space of the root file.

long diskCapacity = new File("/").getTotalSpace();
FThompson
  • 28,352
  • 13
  • 60
  • 93
  • getTotalPhysicalMemorySize()? That returns disk capacity? Seriously? – Paul Tomblin Jun 11 '12 at 16:05
  • Disk capacity is the total amount of space on a drive. What are you talking about? – FThompson Jun 11 '12 at 16:17
  • Memory is not the same thing as disk capacity. The question asks about disk capacity, and you responded with memory. Generally you should try answering the question that was asked, instead of something entirely different. – Paul Tomblin Jun 11 '12 at 17:19
  • You may wish to check up on your [definitions](http://www.computerhope.com/jargon/d/diskcapa.htm). – FThompson Jun 11 '12 at 17:22
  • That link agrees with what I just said - disk capacity is not the same as memory, and getTotalPhysicalMemorySize returns how much RAM the computer has. – Paul Tomblin Jun 11 '12 at 17:24
  • Shoot, I'm terribly sorry for wasting your time. You are correct; I don't know what I was thinking. I've removed that portion of the answer, as the root file space works on Windows as well (I assumed it wouldn't). Sorry about that all. – FThompson Jun 11 '12 at 18:36
  • yeah by disk capacity i meant the total amount of space on a drive, thus indicating its available space and used space – Somye Jun 12 '12 at 04:37