ip-address

Get remote address/IP - C Berkeley Sockets

ε祈祈猫儿з 提交于 2020-01-14 10:49:07
问题 If I have a socket file descriptor connected (either by connect or by bind), type SOCK_STREAM , is it possible to get the remote address / IP address? I need to do this within a function where I don't have any other data than the socket file descriptor. 回答1: getpeername 回答2: See the getsockname() system call. 来源: https://stackoverflow.com/questions/4770127/get-remote-address-ip-c-berkeley-sockets

How do I find a computer's IP address?

≯℡__Kan透↙ 提交于 2020-01-14 03:50:10
问题 I am writing a program in C++ which uses network sockets. I need to find out what the computer's IP address is, so I can display it to the user. The program must run on Windows and Linux. I have heard somewhere that a computer can have multiple IP addresses. I want the one that other programs on different computers can use to connect to the computer. Here is the relevant code I already have (the variables are declared in other places): master = new fd_set; FD_ZERO(master); struct sockaddr_in

Parsing IP Address to string doesn't work for some reason [closed]

非 Y 不嫁゛ 提交于 2020-01-13 07:35:08
问题 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 4 years ago . it's telling me this "An unhandled exception of type 'System.FormatException' occurred in System.dll Additional information: An invalid IP address was specified" IPAddress ipAddr = IPAddress.Parse(richTextBox1.Text); that's the code, richTextBox1 is the default name for a rich textbox. i don't know why this isn

Check if Postgresql is listening

…衆ロ難τιáo~ 提交于 2020-01-12 18:54:29
问题 Given an IP Address and port number, is it possible to check if the machine with that IP address has Postgresql listening on the specified port? If so, how? I just want to obtain a boolean value of whether Postgresql is listening on the specified port of the specified machine. 回答1: I think you need to define what you're trying to achieve better. Do you just want to know if anything is listening on a certain point? If PostgreSQL is listening on a given port? If PostgreSQL is running and

How to get IP address of device in Unity 2018+?

谁说我不能喝 提交于 2020-01-11 07:44:06
问题 How to get IP address on C# in program which developing for android device in Unity 2018.2+? Seems like Network.player.ipAddress is deprecated right now, so I'm looking for a new way. 回答1: The Network.player.ipAddress has been deprecated since it is based on the old obsolete Unity networking system. If you are using Unity's new uNet Network System, you can use NetworkManager.networkAddress; string IP = NetworkManager.singleton.networkAddress; If you are using raw networking protocol and APIs

how to get ip address in codeigniter?

江枫思渺然 提交于 2020-01-09 09:20:09
问题 I am doing this following code for login attempt & i want get IP address of my local machine.. if ( !$this->session->userdata('login_attempts') ) { $this->session->set_userdata('login_attempts', 0); } $attempts = ($this->session->userdata('login_attempts') + 1); $this->session->set_userdata('login_attempts', $attempts); // Check if the session. if ( $this->session->userdata('login_attempts') > 4 ) { echo 'hi....login attempt is over'; } // Failed. So, update the session echo $ip = $_SERVER[

Geocode an IP address? [closed]

♀尐吖头ヾ 提交于 2020-01-09 04:17:34
问题 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 3 years ago . Does anyone know of any open RESTful API that I can call to geocode a user's IP to the latitude and longitude? Ideally, it would be something like: http://google.com/geocode_api/?IP=1.2.3.4 and it would return the latitude and longtitude. 回答1: Another free REST API with city accurate information would be http:/

How can I check if an ip is in a network in Python?

社会主义新天地 提交于 2020-01-08 12:02:11
问题 Given an ip address (say 192.168.0.1), how do I check if it's in a network (say 192.168.0.0/24) in Python? Are there general tools in Python for ip address manipulation? Stuff like host lookups, ip adddress to int, network address with netmask to int and so on? Hopefully in the standard Python library for 2.5. 回答1: This article shows you can do it with socket and struct modules without too much extra effort. I added a little to the article as follows: import socket,struct def makeMask(n):

How can I check if an ip is in a network in Python?

我是研究僧i 提交于 2020-01-08 12:02:08
问题 Given an ip address (say 192.168.0.1), how do I check if it's in a network (say 192.168.0.0/24) in Python? Are there general tools in Python for ip address manipulation? Stuff like host lookups, ip adddress to int, network address with netmask to int and so on? Hopefully in the standard Python library for 2.5. 回答1: This article shows you can do it with socket and struct modules without too much extra effort. I added a little to the article as follows: import socket,struct def makeMask(n):

Getting IP adress associated to REAL hardware ethernet controller in Windows C

非 Y 不嫁゛ 提交于 2020-01-07 09:44:18
问题 I tried to search for it but I could'nt find any working soultions. Nowadays Windows can detect more than ONE PROPER HARDWARE installed eternet controlled due to Hamachi, Virtual box etc etc. Now i need to get the real IP adress of machine. When i tried do it by using gethostbyname it returned IP adress of my Hamachi client. Now I need to find 100% solid method to receive real ip adress. Any links/tips/articles/methods really appreciate. EDIT: So far got this - method sugested by Remy Lebau,