Matthew Toseland schrieb:

> Freenet DOES NOT USE EPHEMERAL PORTS. These are caused by some other
> software on your machine, for example whatever caused 3033 etc, or they
> are misinterpreted. Extraordinary claims require extraordinary evidence
> - see if you can get it to tell you which process owns these sockets.

Bug in Sun JDK 1.4.1 on windows or a bug in netstat?

I created a small (hackish) java app, hopefully without bugs:

// -----------------------
import java.net.*;
import java.io.*;

public class SocketBug {
    public static void main(String[] args) throws Exception {
        new Thread(new Runnable() {
                public void run() {
                    try {
                        ServerSocket ss= new ServerSocket(10000);
                        Socket s= ss.accept();
                        s.getInputStream().read();
                        s.close();
                        ss.close();
                        System.out.println("Thread ended.");
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }).start();
        BufferedReader in  = new BufferedReader
            (new InputStreamReader(System.in));
        System.out.println("Now listening.");
        in.readLine(); // press Return...
        Socket s = new Socket(InetAddress.getByName("127.0.0.1"),
                              10000);
        System.out.println("Now connected.");
        in.readLine(); //press Return again.
        s.getOutputStream().write('x');
        s.close();
        System.out.println("thanks for viewing ;-)");
    }
}
// -----------------------

that does not do more than creating a socket, establishing a connection
to that socket, sending one byte and closing it.

I closed everything except two command prompts and a text editor (to
copy into), and did the following:

(all lines indented with | are from one dos box, the others are from the
other; i stripped all UDP lines from the netstat messages)

--------------------------------
C:\>netstat -na

Aktive Verbindungen

  Proto  Lokale Adresse         Remoteadresse          Status
  TCP    192.168.0.41:139       0.0.0.0:0              ABHÖREN

| C:\>java -version
| java version "1.4.1_01"
| Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
| Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
| 
| C:\>java SocketBug
| 
| Now listening

C:\>netstat -na

Aktive Verbindungen

  Proto  Lokale Adresse         Remoteadresse          Status
  TCP    0.0.0.0:10000          0.0.0.0:0              ABHÖREN
  TCP    192.168.0.41:139       0.0.0.0:0              ABHÖREN

| Now connected

C:\>netstat -na

Aktive Verbindungen

  Proto  Lokale Adresse         Remoteadresse          Status
  TCP    0.0.0.0:10000          0.0.0.0:0              ABHÖREN
  TCP    0.0.0.0:3055           0.0.0.0:0              ABHÖREN
  TCP    127.0.0.1:10000        127.0.0.1:3055         HERGESTELLT
  TCP    127.0.0.1:3055         127.0.0.1:10000        HERGESTELLT
  TCP    192.168.0.41:139       0.0.0.0:0              ABHÖREN

| thanks for viewing ;-)
| Thread ended.
|
| C:\>

C:\>netstat -na

Aktive Verbindungen

  Proto  Lokale Adresse         Remoteadresse          Status
  TCP    192.168.0.41:139       0.0.0.0:0              ABHÖREN

C:\>
--------------------------------

So, when the connection was established (German "hergestellt"), the port
it came from is listed as "listening" (German "abhören") as well. (that
139 port is netbios, did not want to disable my network for that
test...)

Comments?

mihi

_______________________________________________
devl mailing list
[EMAIL PROTECTED]
http://hawk.freenetproject.org:8080/cgi-bin/mailman/listinfo/devl

Reply via email to