Hi,
I am new to socket programming but have experience in Java.
My desktop is connected to the institute LAN and that is how I connect to the rest of the planet.
Now I was trying to make a file tranfer protocol. The socket part of the code is :
For Server:
InetAddress IPServer = InetAddress.getByName("172.26.94.199");
ServerSocket serSoc = new ServerSocket(8000,50, IPServer);
while(true) {
soc = serSoc.accept();
start();
}
For Client
InetAddress serverIP = InetAddress.getByName("172.26.94.199");
soc = new Socket(serverIP, 8000);

When I run the client i get the Exception :
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
at java.net.Socket.connect(Socket.java:507)


The code was working brilliantly till I was using 'localhost', ie :
For Server :
ServerSocket serSoc = new ServerSocket(8000);
while(true) {
soc = serSoc.accept();
start();
}
For Client :
soc = new Socket("localhost", 8000);


Please help me. I just can't figure out the problem.