Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich habe ein kleines Projekt bekommen.

In diesem Projekt muss ich ein Programm schreiben mit dem ich auf einen bestimmten server bestimmte ports,

die offen sind testen kann.

Da ich in der Berufschule nur Java als Programmiersprache lerne, bietet es sich an das Programm in dieser Sprache zu schreiben.

So eine Aufgabe ist für mich komplett neuland, weil ich nur die Grundlagen kenne :rolleyes:

Das Programm sollte nur auf einem bestimmten server zwei offene ports testen.

Ich bin für jede Unterstützung dankbar!

Habe auch eine Port scanner gefunden und diesen versucht so um zu bauen, dass die Ausgabe auf einer grafischen Oberfäche passiert....

Also ich glaube ich verstehe das Problem bei diesem Quelltext nicht so ganz und es funktioniert auch net so ansatzweise face-sad

Wäre für eure Unterstützung sehr dankbar!!

Java Quelltext:

import java.io.IOException;

import javax.swing.*;

import java.net.*;

import java.io.IOException;

import java.awt.*;

import java.awt.event.*;

import java.util.*;

public class PScanner extends Frame{

public PScanner(){

super("Unser erstes Fenster...");

this.setSize(500,300);

this.show();

}

public static void main(String args[]){

PScanner f=new PScanner();

InetAddress ia=null;

String host=null;

try {

host=JOptionPane.showInputDialog("Enter the Host name to scan:\n example: xxx.com");

if(host!=null){

ia = InetAddress.getByName(host);

paint(ia);}

}

catch (UnknownHostException e) {

System.err.println(e );

}

System.out.println("Bye from NFS");

System.exit(0);

variables for menu bar

}

public static void paint(Graphics g ,final InetAddress remote){

int port1=80;

int port2=80;

String hostname = remote.getHostName();

try {

Socket s = new Socket(remote,port1);

Socket p = new Socket(remote,port2);

g.drawString("Server is listening on port "+port1+ "of " + hostname, 100, 60);

g.drawString("Server is listening on port " + port2+ " of " + hostname, 100, 60);

s.close();

}

catch (IOException ex) {

The remote host is not listening on this port

g.drawString("Server is not listening on port " + port1+ " of " + hostname, 100, 60);

g.drawString("Server is not listening on port " + port2+ " of " + hostname, 100, 60);

}

}for ends

}

Quelltext Ende!

Gruß

IT_specialist

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.