Autor Beitrag
Takeshi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Fr 21.03.03 01:30 
hi
sorry, dass ich diese einfache frage poste, aber ich habe sehr viel gesucht und immer nur den verweis auf eine umfangreiche funktion zur ermittlung der eigenen ip im netzwerk gefunden.
ich moechte in meinem server einfach die ip anzeigen lassen, die der client nacher zum connecten eingeben muss. leider gibt mir ServerSocket1.Socket.LocalAddress nur eine 0.0.0.0 zurück.
ich dachte aber eigentlich schon ,dass man irgendwie auf nicht allzu kompliziertem wege die ip herausfinden kann, die der server-socket hat.?
vielen dank schonmal, greez, Takeshi
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Fr 21.03.03 03:12 
Hi,

das einfachste is wohl einfach die Powersock Komponente (FastNet) zu benutzen.

Deine IP bekommst du dann mit Powersock1.LocalIP raus :)

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
Takeshi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64



BeitragVerfasst: Sa 22.03.03 16:28 
thx funzt ganz gut.

die powersock komponente kann aber nicht die funktion einer server/client-socket komponente uebernehmen oder ?

anyway merci beaucoup!
focus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 187

XP, 2k, 98, Me
D6 Prof
BeitragVerfasst: Fr 28.03.03 09:39 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
function GetIpAddress: string;
var
  phoste: PHostEnt;
  Buffer : array [0..100] of char;
  WSAData: TWSADATA;
begin
  result := '';
  if WSAStartup($0101, WSAData) <> 0 then exit;
  GetHostName(Buffer, Sizeof(Buffer));
  phoste := GetHostByName(buffer);
  if phoste = nil then result := '127.0.0.1'
  else result:= StrPas(inet_ntoa(PInAddr(phoste^.h_addr_list^)^));
  WSACleanup;
end;