DPlay - Client IP Address ??

Started by
4 comments, last by SngMan Jeon 22 years, 1 month ago
I''m Korean. I can''t speak english very well!! Sorry. please. I''m beginner. I use Delphi & VC. I don''t know get IP Address...!! ? DirectPlay8Peer::GetPeerAddress ? IDirectPlay8Server::GetClientAddress() ? IDirectPlay8Client::GetServerAddress() I want save - Client IP Address.. exam) 168.126.63.1 <-- i want style... (string)
Programmer
Advertisement
If you do a search at www.google.com on "local ip address winsock" you will find this site:

http://tangentsoft.net/wskfaq/examples/ipaddr.html

I got the help I needed when I was doing the same thing you ask.. It uses winsock to get the local IP address. Small example program included

-----------------------------
"If I''m not careful, I''ll end up talking to myself!"
_____________________________
www.OddGames.comwww.OddGames.com/daniel
Tank you. very much
But, I want Using DxPlay.. <- no socket ;(

please... help me!!

//----------------------------------------------
//--- This is ..
//--- How get - Local IP Address
//--- socket using
//--- This - Delphi code.
type
TaPInAddr = array [0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
....
....
....

function GetLocalIP : string;
var
phe : PHostEnt;
pptr : PaPInAddr;
Buffer : array [0..63] of char;
I : Integer;
begin
Result := '''';
GetHostName(Buffer, SizeOf(Buffer));

phe := GetHostByName(Buffer);
if phe = nil then
Exit;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^ <> nil do begin
Result := StrPas(inet_ntoa(pptr^^));<br> Inc(I);<br> end;<br>end;<br> </i>
Programmer
Using below functions!! Examples code please..
? IDirectPlay8Server::GetClientAddress
? DirectPlay8Peer::GetPeerAddress


I want save - Client IP Address..
exam) 168.126.63.1 <-- i want style... (string)




Programmer
Sorry, I haven''t done it with dplay just used winsock. But if you only want the local ip address to a string.. then the method of retriving it shouldn''t matter.

-----------------------------
"If I''m not careful, I''ll end up talking to myself!"
_____________________________
www.OddGames.comwww.OddGames.com/daniel
You need to look into the GetComponentByName method of the IDirectPlay8Address interface. I don''t have any code to post, but if you try it out and post what you come up with here and any problems you have, I''ll try to help.

This topic is closed to new replies.

Advertisement