A problem with the access to local network
I've got LAN and I want to connect to another computer to its shared files. How could I do this?
When I try this:
public class LanListener {
URL url;
/** Creates a new instance of LanListener */
public LanListener() {
try {
url = new URL("file://192.168.1.2");
BufferedReader in = new BufferedReader(
new InputStreamReader(
url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
catch( IOException e ) {
e.printStackTrace();
}
}
public static void main(String args[]) {
new LanListener();
}
}
It gives me - java.net.ConnectException: Connection refused: connect
.......
Please HELP ME =)
[824 byte] By [
burchika] at [2007-11-27 8:52:55]

The file:// transfer type means to look on the local disk, not over the network. You're making it look for a file named "192.168.1.2".
What's on that host? Does that host have a web server? Does it have an ftp server or an ssh server? Does it provide a networked filesystem or something like Samba?
Well, I've got LAN and I want to browse shared folders in other machines. I can do it by : Start -> Run -> \\192.168.1.3 -> and I'll see shared folders, printers. I want to make this in Java. So, how to view shared folders in other LAN machines?
> Well, I've got LAN and I want to browse shared
> folders in other machines. I can do it by : Start ->
> Run -> \\192.168.1.3 -> and I'll see shared folders,
> printers.
That's an entirely different thing from a "file:" URL. The \\ tells Windows to mount a networked host as a shared drive, via SMB, I think. I try to avoid Windows networking so I'm not sure of the details.
Anyway, this is a Windows-specific way to network a drive. Maybe Windows has defined a URL transfer type specifier to name that sort of thing. You might want to try the Microsoft web site.
> I want to make this in Java.
> So, how to view shared folders in other LAN machines?
Well, suppose you were going to access those files via your web browser. What URL would you type in?