I am currently learning about Networking and Sockets to prepare for my Sun
Java Development exam.
Below is a scenairo about networking:
If a company has five computers all connected via a network as below:
Computer�s Name Type of Computer
Comp1 Windows NT Server
Comp2 Windows NT Server
Comp3 Windows NT Workstation
Comp4 Windows NT Workstation
Comp5 Windows NT Workstation
Below is a program that uses a ServerSocket class to create a Server:
import java.net.*;
import java.io.*;
public class SimpleServer {
public static void main(
String args[]){
ServerSocket s = null;
Socket s1;
String sendString="Hello from the Server";
OutputStream slout;
DataOutputStream dos;
try{
s=new ServerSocket(5432);
System.out.println("Server ready");
}catch(IOException e){}
while(true){
try{
s1=s.accept();
slout=s1.getOutputStream();
dos=new DataOutputStream(slout);
dos.writeUTF(sendString);
dos.close();
slout.close();
s1.close();
}catch(IOException e){}
}
}
}
QUESTION:
The question that I would like to ask is must the Server program above be placed in a Server computer (Comp1 and Comp2) or is it OK to put the Server program in a Workstation (Comp3, Comp4 and Comp5) and the Workstation can acts as a server? So for example, can I put the Server program in Comp3 (Workstation) so that Comp3 can acts as a Server to Comp4 (Workstation) and Comp5 (Workstation) ?