ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Programming Languages  >>  Delphi
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
How to Get the local internet machine name and IP address?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How to Get the local internet machine name and IP address?
Answer
# 1
function GetIPFromHost
(var HostName, IPaddr, WSAErr: string): Boolean; 
type 
  Name = array[0..100] of Char; 
  PName = ^Name; 
var 
  HEnt: pHostEnt; 
  HName: PName; 
  WSAData: TWSAData; 
  i: Integer; 
begin 
  Result := False;     
  if WSAStartup($0101, WSAData) <> 0 then begin 
    WSAErr := 'Winsock is not responding."'; 
    Exit; 
  end; 
  IPaddr := ''; 
  New(HName); 
  if GetHostName(HName^, SizeOf(Name)) = 0 then
  begin 
    HostName := StrPas(HName^); 
    HEnt := GetHostByName(HName^); 
    for i := 0 to HEnt^.h_length - 1 do 
     IPaddr :=
      Concat(IPaddr,
      IntToStr(Ord(HEnt^.h_addr_list^[i])) + '.'); 
    SetLength(IPaddr, Length(IPaddr) - 1); 
    Result := True; 
  end
  else begin 
   case WSAGetLastError of
    WSANOTINITIALISED:WSAErr:='WSANotInitialised'; 
    WSAENETDOWN      :WSAErr:='WSAENetDown'; 
    WSAEINPROGRESS   :WSAErr:='WSAEInProgress'; 
   end; 
  end; 
  Dispose(HName); 
  WSACleanup; 
end;
 
Is This Answer Correct ?    1 Yes 0 No
Venu
 

 
 
 
Other Delphi Interview Questions
 
  Question Asked @ Answers
 
How to Display 4 digit years in Delphi applications?  1
What is Delphi/400 Client Server Suite? IBM1
How to retrieve the position of the cursor?  1
How to Find the column and row of the cursor in a TRichEdit?  1
How to Use Date as a Field Name ?  1
Where is the file dsgnintf.pas?  1
Name the File Extensions for dBASE and Paradox tables?  1
What databases can be used with dbExpress?  1
what is rounding?  1
When I try to execute sql query from delphi7 it throws the following exception ORA-01704: string literal too long. I know the reason why its throwing this exception. My problem is.... I have catched this exception throw Try.... Except block.....In except block i am performing rollback..... due to above error its also throwing exception in rollback transaction...........due to rollback exception...........it had created some problem in connection...........every time when i try to open or close a connection it throws an exception " Operation is not allowed when the object is open"  1
How to change file attributes programmatically?  1
How to Retrieve a long file name from the command line ?  1
'Missing Data Provider or Data Packet' . what does this error mean?  1
How to display the current user name? CTS1
How to Get the local internet machine name and IP address?  1
How to draw directly on the Windows Desktop? Infosys1
 
For more Delphi Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com