• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Networking

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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) ?
 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can run your server program anywhere u want, including workstations. What's more, u can even run ur server and client on the same machine.
- Manish
 
This is awkward. I've grown a second evil head. I'm going to need a machete and a tiny ad ...
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic