Archived

This topic is now archived and is closed to further replies.

DPlay - Client IP Address ??

This topic is 5779 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)

Share this post


Link to post
Share on other sites
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!"

Share this post


Link to post
Share on other sites
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^[I]^));
Inc(I);
end;
end;

Share this post


Link to post
Share on other sites
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)




Share this post


Link to post
Share on other sites
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!"

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites