--------请问不用hostname,还能不能得到客户端的ip地址,谢了

defender 2003-10-10 05:44:39
同上
...全文
61 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
defender 2003-10-16
  • 打赏
  • 举报
回复
up
defender 2003-10-13
  • 打赏
  • 举报
回复
请问楼上,怎么通过net_address来找到其对应的ip地址,多谢了
---涛声依旧--- 2003-10-11
  • 打赏
  • 举报
回复
net_address里面存放的是物理地址Physical Address,找到其對應的IP Adress后﹐用ping IP地址即可知道其Host Name了。但是如何找到其對應的IP Adress﹐要找網絡管理員了(因為每個網卡的物理地址是全球唯一的﹐但它所設置的IP地址可能隨時變了﹐要看網絡管理員給其設置的IP地址是多少了)
defender 2003-10-10
  • 打赏
  • 举报
回复
sorry,,可能我没有表述清楚
我的在sysprocesses里面的hostname,全部为空值,但是net_address却有值,请问有什么办法没有,谢了
txlicenhe 2003-10-10
  • 打赏
  • 举报
回复
--由sysprocesses的net_address先查出电脑名(不是用host_name()函数)
declare @hst varchar(20)
Select @hst = hostname from master..sysprocesses where net_address = @网卡地址

--再由电脑名得到IP
declare @ip varchar(20),@sql varchar(100)
declare @str varchar(100)
set @str='PING '+@hst
create table #tmp(aa varchar(200))
insert #tmp exec master..xp_cmdshell @str
select top 1 @ip = replace(left(aa,charindex(':',aa)-1),'Reply from ','')
from #tmp where aa like 'reply from %:%'
drop table #tmp
select @ip
defender 2003-10-10
  • 打赏
  • 举报
回复
也就是说有没有办法从sysprocesses表里的net_address或者其它字段得到客户端的IP地址,谢了

34,875

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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