ip-address

When retrieving URL via HttpWebRequest, can I see the IP address of the destination server?

倖福魔咒の 提交于 2019-12-11 02:48:58
问题 Suppose I am retrieving a url as follows: string url = "http://www.somesite.com/somepage.html" HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); Is there a way I can see the IP address of the destination url? Does it require a separate call? Thanks 回答1: Look at the System.Net.Dns class. You can get a list of IP addresses of the host from the Dns.GetHostEntry() method. 回答2: Although Dns.GetHostEntry() can get you the IP of

How get client (user) machine name (computer name) with jQuery or JavaScript or server-side codes. (scrutiny of possible ways)

社会主义新天地 提交于 2019-12-11 02:09:31
问题 I was working on Retrieving IP address and client machine name for few days on the internet (not on the local network) so I found some ways for getting IP-address , but I couldn't find a way for getting client machine name or gathering some info about my web site users ? I know there are many duplicate threads about this issue out there , but many of them are old or do n't work. the below server side codes return SERVER NAME Not client computer name ! string UserHost_ComputerName4 = Dns

How can I find all locally bound IP addresses in Java?

倖福魔咒の 提交于 2019-12-11 01:22:03
问题 I would like to have all locally bound IP addresses, basically an array of java.net.InetAddress. I know I can call InetAddress.getAllByName() with the host name, but I was wondering if there is a more direct way that doesn't involve DNS and/or knowledge of the host name. 回答1: java.net.NetworkInterface.getNetworkInterfaces() will give you an enumeration of the available network interfaces. You can then invoke getInetAddresses() on each NetworkInterface to get the addresses bound to this

How to find IP address range

倖福魔咒の 提交于 2019-12-11 00:38:12
问题 When I use this command which IP addresed are scanned # nmap -sP 192.168.0.120/25 CAn you please help me how to get the IP range when I have the addres and subnet. Because I am trying to understand this, but no result till now..Thanks in advance 回答1: The network in your command is in CIDR notation. The first part (before the / ) defines which network, and the second part defines how many bits of netmask are set. An IPv4 address is 4 bytes, or 32 bits of information. /25 means that 25 bits of

C# - Converting IntPtr pointing to sockaddr structure to IPAddress

岁酱吖の 提交于 2019-12-10 21:55:05
问题 From a P/Invoked native function, I get an IntPtr which points to a sockaddr structure. How can I convert it to an IPAddress? Thanks! 回答1: Since you can't directly Marshal a sockaddr type into an IPAddress type, you'd have to make a managed struct out of it first to marshal it into: [StructLayout(LayoutKind.Sequential)] internal struct sockaddr_in { internal EnumLib.ADDRESS_FAMILIES sin_family; internal ushort sin_port; internal in_addr sin_addr; [MarshalAs(UnmanagedType.ByValArray, SizeConst

IP address v4/v6 equivalence testing

不羁岁月 提交于 2019-12-10 21:12:38
问题 Is it possible to test IP addresses for equivalence in a dual stack environment using both IPv4 and IPv6? If so, how? My application uses websocket++ on top of Boost ASIO. As an example, on my LAN, one application connects to another listening on 192.168.1.2 , but using this answer's IP address getter std::string s = socket.remote_endpoint().address().to_string(); gives ::ffff:192.168.1.3 as the client's address. The problem is that .2 will have its own node list with the original v4 address

How to use IPAddress and IPv4Mask to obtain IP address range?

我只是一个虾纸丫 提交于 2019-12-10 20:58:10
问题 I'm trying to accomplish the following in C#/.NET 2.0: Given an IPAddress object (say, 192.168.127.100) and another IPAddress object containing the IPv4Mask / subnet mask (say, 255.255.248.0), I should be able calculate the start and end of the IP Address range. (Yes, I'm trying to do a for-loop thru a range of addresses on a subnet.) Theoretically, I should be able to bitwise AND on the IPAddress and the SubnetMask to get the IPStart. Then I should be able to perform a bitwise XOR on the

Are the terms “external IP address” and “public IP address” synonomous? [closed]

我怕爱的太早我们不能终老 提交于 2019-12-10 20:44:46
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . Is there a difference in the meaning of external IP address vs public IP address and internal IP address vs private IP address? 回答1: Yes, external and public IP address would be the same thing, and internal or

How to find MAC address on Windows 7? [closed]

你离开我真会死。 提交于 2019-12-10 20:16:32
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . i can find the MAC address of my machine with command ipconfig /all on command prompt. Everywhere on net says physical address is MAC address. Here is the result of command ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : XXXX Primary Dns Suffix . . . . . . . : XXXX Node Type . . . . .

Hashing an IP address to a number in [0, H)

感情迁移 提交于 2019-12-10 19:43:54
问题 I'm using Python-2.6. I have very little knowledge of hash functions. I want to use a CRC hash function to hash an IP address like '128.0.0.5' into the range [0, H). Currently I'm thinking of doing zlib.crc32('128.0.0.5')%H. Is this okay? There's a few ques. you could try and answer... does it make any diff. if I hash '128.0.0.5' or its binary '0001110101010..' whatever that is or without the '.'s zlib.crc32 returns a signed integer. Does modding (%) a neg. with a positive H always give a pos