Hallo, het onderstaande applet heb ik zojuist geprogrammeerd, hiermee wordt een port gescand. Helaas kan ik dit portscannen op een ander ip adres dan waar mijn .class bestand in een applet staat niet uitvoeren. Het lukt wel met localhost of zonder gebruik van de applet.
Ook weet ik dat dit komt door de security van een applet, kan iemand mij aangeven hoe ik heel gemakkelijk dit wel voor elkaar kan krijgen?
import java.applet.*;
import java.awt.*;
import java.net.*;
import java.io.*;
public class lfpApplet extends Applet
{
Socket theSocket;
String host = "www.tweakers.net";
public void init()
{
}
public void paint(Graphics g)
{
setBackground(Color.yellow);
try
{
theSocket = new Socket(host,80);
g.drawString("Poort 80 gevonden op: " + host,20,20);
}
catch (UnknownHostException e)
{
System.err.println(e);
}
catch (IOException e)
{
// must not be a server on this port
}
}
}
Ook weet ik dat dit komt door de security van een applet, kan iemand mij aangeven hoe ik heel gemakkelijk dit wel voor elkaar kan krijgen?
import java.applet.*;
import java.awt.*;
import java.net.*;
import java.io.*;
public class lfpApplet extends Applet
{
Socket theSocket;
String host = "www.tweakers.net";
public void init()
{
}
public void paint(Graphics g)
{
setBackground(Color.yellow);
try
{
theSocket = new Socket(host,80);
g.drawString("Poort 80 gevonden op: " + host,20,20);
}
catch (UnknownHostException e)
{
System.err.println(e);
}
catch (IOException e)
{
// must not be a server on this port
}
}
}