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  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   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
 
what is rounding?  1
How to Allot CPU time ?  1
How to change file attributes programmatically?  1
Why you want to join IBM only not others like, TCS Infosys, Satyam & Wipro Etc. please do'nt give general answers?. IBM1
How to display the current user name? CTS1
What databases can be used with dbExpress?  1
Name the File Extensions for dBASE and Paradox tables?  1
How to Get the local internet machine name and IP address?  1
How to Retrieve a long file name from the command line ?  1
How to Use Date as a Field Name ?  1
How to Find the column and row of the cursor in a TRichEdit?  1
How to retrieve the position of the cursor?  1
"DAX Error - Name not unique in this context" . what does this error mean?  1
'Missing Data Provider or Data Packet' . what does this error mean?  2
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
Explain Drag and Drop with Files?  1
how can i add 2 numbers using delphi console application and also windows application , compare both program , reply immediatly  1
How to Use an instance of TPrinter ? Delta1
How to draw directly on the Windows Desktop? Infosys1
How to Manually uninstall Delphi?  1
 
For more Delphi Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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