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.

gethostname() liefert unter W98 komische Nummer

Empfohlene Antworten

Hallo, ich bins schon wieder.

In meinem Programm verwende ich die Funktion gethostname().

Diese liefert den lokalen Computernamen zurück.

In meinem Betrieb, unter W2000, war das "sepnt3". Das ist auch richtig so.

Aber als ich dann zu Haus mein Programm unter W98 gestartet habe kam auf einmal 61136382, oder so ähnlich zurück.:confused: Diese Nummer konnte er aber sogar mit gethostbyname() aufschlüsseln, sodass er meine richtige IP rausfinden konnte.

Ich versteh das nicht.

Warum hat er nicht meinen richtigen Computernamen, hp, herausgefunden?

Und was ist das für ne komische Nummer?

Holla he....

Die MSDN Library sagt dazu:

Remarks

The gethostname function returns the name of the local host into the buffer specified by the name parameter. The host name is returned as a null-terminated string. The form of the host name is dependent on the Windows Sockets provider — it can be a simple host name, or it can be a fully qualified domain name. However, it is guaranteed that the name returned will be successfully parsed by gethostbyname and WSAAsyncGetHostByName.

Note If no local host name has been configured, gethostname must succeed and return a token host name that gethostbyname or WSAAsyncGetHostByName can resolve.

vielleicht hilft dir das ja weiter... mehr kann ich auch ned dazu sagen...

Uruz

:D

Machen wir uns doch mal den Spaß und beginnen zu rechnen :P

Also, das Ergebnis war 61136382 - oder so ähnlich. Dabei handelt es sich, unschwer zu erkennen, um eine Dezimalzahl.

Diese Zahl mal fix in einen Taschenrechner Deiner Wahl getippt und nach hex umgewandelt ergibt: 3A4DDFE oder 03 A4 DD FE. Mit Punkten getrennt und die einzelnen Hexwerte wieder zurück nach dezimal ergibt das 3.164.221.254.

Und das sieht doch nach einer gültigen IP aus. Etwas kurios, könnte aber durchaus sein - die Zahl von Dir war ja nicht ganz genau :D

PS: So an den Haaren ist das gar nicht hergezogen. Rechnet eine IP ruhig mal nach dezimal um und gebt die Zahl in einem Browser eurer Wahl ein. Er wird die gewollte Seite finden, nur einige Proxys haben mit dezimalen Werten ihre Probleme :cool:

jau stimmt... hab das auch mal in einer CT gelesen... irgendwann anfang letzten jahres... oder ?

Uruz

oder eben so...

:D

Hallo nochmal...

Also, die nummer lautet genau so: 520071134382

Umgerechnet in eine IP wie es dr. disk gesagt hat waere das dann 22.167.188.174.

Aber diese IP besitze ich nicht. Sie sieht zwar aus, wie eine vom Internet zugewiesene Adresse, aber das ist sie nicht.

Wenn ich drauf Ping gibts ein Timeout.

Noch jemand eine Idee, woher diese besch****** Nummer kommt? - Ich werde bald wahnsinnig!

a) read the msdn (msdn.microsoft.com)

B) check the return value (hr), if (SUCCEEDED(hr))....

see?!

Hallo nochmal!

Also für die dies interessiert:

Ich weiss jetzt endlich, was das für ne Nummer ist.

Ein Arbeitskollege hat mich drauf gebracht, dass das meine t-online Nummer sein könnte. Ja und das war sie auch.

Jetzt stellt sich nur die frage, wie gethostname auf diese Nummer kommt... Vielleicht weil ich sie ins DNS-Suffix eingetragen habe?

cu

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.