如何取得宽带上网的IP地址,解决给分,在线.....

Dephiuser 2003-09-10 01:09:28
我用ADSLMODEM接入网卡上网.
...全文
52 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
Dephiuser 2003-09-17
  • 打赏
  • 举报
回复
再次提问!
下班结贴!UP有分!
kingtingshuo 2003-09-15
  • 打赏
  • 举报
回复
mark
ideacao 2003-09-14
  • 打赏
  • 举报
回复
up
sevencat 2003-09-13
  • 打赏
  • 举报
回复
ipconfig/all
FSU 2003-09-13
  • 打赏
  • 举报
回复
ipconfig得到的是本机的IP
solonet 2003-09-13
  • 打赏
  • 举报
回复
ipconfig 是无法取得互联网上的IP
sevencat 2003-09-12
  • 打赏
  • 举报
回复
上面这个函数一般第一个IP地址是127.0.0.1
sevencat 2003-09-12
  • 打赏
  • 举报
回复
indy里面还有个函数
procedure TIdStackWindows.PopulateLocalAddresses;
type
TaPInAddr = Array[0..250] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
i: integer;
AHost: PHostEnt;
PAdrPtr: PaPInAddr;
begin
FLocalAddresses.Clear ;
AHost := GetHostByName(PChar(WSGetHostName));
if AHost = nil then
begin
CheckForSocketError(SOCKET_ERROR);
end
else
begin
PAdrPtr := PAPInAddr(AHost^.h_address_list);
i := 0;
while PAdrPtr^[i] <> nil do
begin
FLocalAddresses.Add(TInAddrToString(PAdrPtr^[I]^));
Inc(I);
end;
end;
end;
这是那个函数的原代码。是不是很简单,你可以直接调用就可以了。
hbwjz 2003-09-12
  • 打赏
  • 举报
回复
failer(独败)

你那个得到的是固定ip吧!
Dephiuser 2003-09-11
  • 打赏
  • 举报
回复
谢谢大家!我在试一下!
XXSingle 2003-09-11
  • 打赏
  • 举报
回复
up,,,,,,,,,
sevencat 2003-09-10
  • 打赏
  • 举报
回复
IP助手函数里面能找到的。(mmsdn中ip helper函数族)
另外这些函数还包括网卡的一些设置。
增加一个IP地址。
。。。很多呀
下面这个函数是得到一个数组的。
GetIpAddrTable

The GetIpAddrTable function retrieves the interface–to–IP address mapping table.


DWORD GetIpAddrTable(
PMIB_IPADDRTABLE pIpAddrTable,
PULONG pdwSize,
BOOL bOrder
);

Parameters
pIpAddrTable
[out] Pointer to a buffer that receives the interface–to–IP address mapping table as a MIB_IPADDRTABLE structure.
pdwSize
[in, out] On input, specifies the size of the buffer pointed to by the pIpAddrTable parameter.
On output, if the buffer is not large enough to hold the returned mapping table, the function sets this parameter equal to the required buffer size.

bOrder
[in] Specifies whether the returned mapping table should be sorted in ascending order by IP address. If this parameter is TRUE, the table is sorted.
Return Values
If the function succeeds, the return value is NO_ERROR.

If the function fails, the return value is one of the following error codes.

Return Code Description
ERROR_INSUFFICIENT_BUFFER The buffer pointed to by the pIpAddrTable parameter is not large enough. The required size is returned in the DWORD variable pointed to by the pdwSize parameter.
ERROR_INVALID_PARAMETER The pdwSize parameter is NULL, or GetIpAddrTable is unable to write to the memory pointed to by the pdwSize parameter.
ERROR_NOT_SUPPORTED This function is not supported on the operating system in use on the local system.
Other Use FormatMessage to obtain the message string for the returned error.
cpmax 2003-09-10
  • 打赏
  • 举报
回复
Delphi里有一个控件可以用,好像intenet或FastNet属性页里,只用一句就可以了,是什么控件我忘记了,
Dephiuser 2003-09-10
  • 打赏
  • 举报
回复
试试!
failer 2003-09-10
  • 打赏
  • 举报
回复
我从
http://expert.csdn.net/Expert/TopicView1.asp?id=1937215
转的。
failer 2003-09-10
  • 打赏
  • 举报
回复
function LIP : string;
type
TaPInAddr = array [0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
phe : PHostEnt;
pptr : PaPInAddr;
Buffer : array [0..63] of char;
I : Integer;
GInitData : TWSADATA;
begin
WSAStartup($101, GInitData);
Result := '';
GetHostName(Buffer, SizeOf(Buffer));
phe :=GetHostByName(buffer);
if phe = nil then Exit;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^[I] <> nil do begin
result:=StrPas(inet_ntoa(pptr^[I]^));
Inc(I);
end;
WSACleanup;
end;
Dephiuser 2003-09-10
  • 打赏
  • 举报
回复
急......
Dephiuser 2003-09-10
  • 打赏
  • 举报
回复
2000 cmd >ipconfig
delphi中编程如何实现!
tanqth 2003-09-10
  • 打赏
  • 举报
回复
对了,是那命令,记得有多个网卡时看清那一个是外网的。
tanqth 2003-09-10
  • 打赏
  • 举报
回复
win 98 用winipcfg 命令
2000中用ipconfig (好像是,记不太清)

1,594

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧