Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[12927] Re:[자답]내PC의 IP주소는 어떻게 가져오나요?
하두고 [hadugo] 1979 읽음    2009-09-25 18:22
여기 저기 한참 찾아보니 있었네요.^^


function GetLocalIP: string;
var
  wsaData: TWSAData;
  slocal: string;
  hos: PHostEnt;
  addr: PChar;
begin
  result := '';
  if WSAStartup($101, wsaData) <> 0 then exit;
  SetLength(slocal, 256);
  if gethostname(PChar(slocal), 256) = SOCKET_ERROR then exit;
  hos := gethostbyname(PChar(slocal));
  if hos = nil then exit;
  addr := (hos.h_addr_list)^;
  result := IntToStr(Byte(addr[0])) + '.' + IntToStr(Byte(addr[1])) + '.'
    + IntToStr(Byte(addr[2])) + '.' + IntToStr(Byte(addr[3]));
  WSACleanup;
end;

+ -

관련 글 리스트
12926 내PC의 IP주소는 어떻게 가져오나요? 하두고 1693 2009/09/25
12927     Re:[자답]내PC의 IP주소는 어떻게 가져오나요? 하두고 1979 2009/09/25
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.