[NEWSboard IBMi Forum]

Hybrid View

  1. #1
    Registriert seit
    Aug 2004
    Beiträge
    19

    IP-Adresse und Ports in Datei ausgeben

    Hallo Spezialisten.

    Irgendwie muss es doch möglich sein, die IP-Adresse und die Ports in eine Datei auszugeben.

    Mit NETSTAT *CNN kann ich sie ja nur ansehen.

    Da gibt es doch irgendein API oder Tool, oder?

    MfG
    Michael Friedland

  2. #2
    Registriert seit
    May 2002
    Beiträge
    2.643

    Ports mit API

    Hallo Michael,
    ich habe dies hier auf die schnelle gefunden:

    Are there any commands or API's available which retrieve information relating to TCP/IP port numbers?
    A: There are the getservbyname() and getservbyname_r() API's which allow you to retrieve an associated port for a given service name. Unfortunately, the results do not indicate whether the specific service is running. Furthermore, if a third party program is using a specific port, it will most likey not be registered in the services file.
    The List Network Connections (QtocLstNetCnn) API can be used to retrieve status for the full range of local ports, or a subset of the ports, or by local IP address. The information returned will show if any given port is being used and what the status of it is. The InfoCenter describes this API in more detail.
    The Retrieve Network Connection Data (QtocRtvNetCnnDta) API can be used to identify the job/program associated with an active port. Information for this API can also be found in the InfoCenter.
    NOTE: The InfoCenter has become our primary source of information for questions such as this.
    http://publib.boulder.ibm.com/pubs/h...nfocenter.html

  3. #3
    Registriert seit
    May 2002
    Beiträge
    2.643

    API Beispiel

    Hallo Michael,
    jetzt habe ich noch das gefunden:

    APIS BY EXAMPLE: LIST NETWORK CONNECTIONS (QTOCLSTNETCNN) API
    One message I see periodically in the newsgroups is a request for sample
    source code showing how to retrieve the same information that is displayed
    by the NETSTAT command. With V5R1, this information has been made available
    via the List Network Connections (QtocLstNetCnn) API, which returns a non-
    detailed list of all network connections or a subset of all network
    connections for a specified network connection type.

    Bryan Dietz has recently released his free NStat utility, which uses the
    QtocLstNetCnn API. The utility prompt screen is shown below:

    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    ***********************NStat - OutPut for NetStat (NSTAT)

    *Type choices, press Enter.
    *Include Listening Ports? . . . . > Y **********Y, N
    *Output . . . . . . . . . . . . . > *FILE *******PRINT, *FILE
    *File Name *. . . . . . . . . . . > FILENAME ***Name
    Library *. . . . . . . . . . . > **LIBRARY **Name, *LIBL
    *File Option *. . . . . . . . . . ***ADD *******Name, *ADD, *REPLACE
    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

    If you select the *FILE option, the utility creates a file in the following
    format:

    Field Name *Type *Pos *Len Dec
    LCLADDR *****A ****1 ***15
    RMTADDR *****A ***16 ***15
    LCLPORT *****S ***31 ****5 *0
    RMTPORT *****S ***36 ****5 *0
    BYTESIN *****S ***41 ***10 *0
    BYTESOUT ****S ***51 ***10 *0
    IDLEHOUR ****S ***61 ****3 *0
    IDLEMIN *****S ***64 ****2 *0
    IDELSEC *****S ***66 ****2 *0
    CONNSTAT ****A ***68 ***11 *
    CONNTYPE ****A ***79 ***10
    OUTPUTTIME **Z ***89 ***26 *0

    The source for the utility is provided, so you can see for yourself how
    QtocLstNetCnn is used. You can download the utility from
    http://home.columbus.rr.com/jbmmdietz/iseries.html.

    The V5R1 documentation for the QtocLstNetCnn is available at
    http://publib.boulder.ibm.com/iserie...apis/comm8.htm

  4. #4
    Registriert seit
    Jun 2001
    Beiträge
    388
    Hallo Michael,

    also für Jobs/Telnet-Sessions kannst Du über die API's QUSRJOBI mit der Schablone JOBI0600 und QDCRDEVD mit der Schablone DEVD0600 die IP-Adressen ermitteln, such einfach mit Google nach den API's. Ich habe mal ein Tool gefunden, welches dem Netstat/3 entspricht und die IP-Adressen auch eine Option zur Dateiausgabe enthält. Bei Interesse kannst Du mir ja an herzfeldta@acti.de Deine adresse mailen und ich schicke Dir dann das Tool als SAVF.

    Andreas
    Andreas Herzfeldt

  5. #5
    Registriert seit
    Aug 2004
    Beiträge
    19

    IP-Adresse und Ports in Datei ausgeben

    Hallo TARASIK.
    Hallo Andreas.

    Vielen Dank für Eure Unterstützung, Tips und das SAVF.

    Ich kann meine Anforderungen erfüllen, meine Probleme lösen.

    Gruß
    Michael

Similar Threads

  1. OKI Nadeldrucher unter V4R5 mit IP Adresse
    By Eric in forum NEWSboard Drucker
    Antworten: 0
    Letzter Beitrag: 25-09-05, 21:56
  2. SQL-Statement in Datei ausgeben
    By Proggi in forum NEWSboard Programmierung
    Antworten: 6
    Letzter Beitrag: 14-09-05, 16:58
  3. WINS bei AS400 abschalten bzw. unterbinden
    By cc in forum IBM i Hauptforum
    Antworten: 3
    Letzter Beitrag: 13-10-04, 22:49
  4. 2 Netzwerkkarten aber nur 1 IP Adresse ?
    By rcide in forum IBM i Hauptforum
    Antworten: 3
    Letzter Beitrag: 27-08-04, 13:04
  5. IP Ports
    By itag in forum IBM i Hauptforum
    Antworten: 5
    Letzter Beitrag: 03-01-02, 12:33

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • You may not post attachments
  • You may not edit your posts
  •