|
안녕 하세요?
BacTeria 박종민 입니다.
들렀다가 또 끼적거립니다.
아래 제라툴님이 언급하셨던 IP 얻는 방법 입니다.
참고 하세요~ 참!! 델파이 소스네요~
----------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses WinSock;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var
wVersionRequested: WORD;
wsaData: TWSAData;
begin
wVersionRequested := MAKEWORD(1, 1);
WSAStartup(wVersionRequested, wsaData);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
p: PHostEnt;
s: array[0..128] of char;
p2: pchar;
begin
{Get the computer name}
GetHostName(@s, 128);
p := GetHostByName(@s);
Memo1.Lines.Add(p^.h_Name);
{Get the IpAddress}
p2 := iNet_ntoa(PInAddr(p^.h_addr_list^)^);
Memo1.Lines.Add(p2);
end;
end.
모라 님이 쓰신 글 :
:
: 볼랜드 소켓이나 인디 소켓쪽으로 자신의 아이피를 알려면 어떻해야 하죠?
:
:
|