How to identify the user’s IP?

Asked

Viewed 123 times

0

How to get the network IP of who open my program? I am using the language C++, Visual Studio 2013 and Windows Form, there is some function that does this?

  • It’s hard enough to understand your problem. Can you explain?

  • I am unable to check the IP in the database, because the IP variable is char and the IP field is varchar (string);

  • If you make an IP "prinf", you have? The fact that the IP "in C" and a CHAR and the field a VARCHAR does not matter. From the point of view of SQL you ta looking for a "string" and for it it does not matter if from the C side the "string" to a char or something else. A very useful thing to do is to avoid placing the query directly in the so-called "Mysqlcommand("SELECT...". It is better to have a variable with the query. Thus, it is easy to make a "printf" of the variable to check if the query this bandstand.

  • Could you give me an example?

  • "The error line is this". What error? Can you put exactly the message you receive (or the unexpected behavior you see)?

  • I found that this method of catching the ip is wrong, it returns 11, I’ve tried several ways to get the user’s ip and I can’t.

  • I’m sorry, but that last issue completely changed the question. What exactly do you want to know? Is it database query? Is it about variable conversion? Is it about checking the machine’s current IP? Not clear.

  • I want to know the IP of the user’s network ex: 198.35.56.100 and then do a check in the Database (Mysql) to know if it exists there.

  • So it’s two separate, unrelated questions. I will edit this for the first question and then create another question for the query in Mysql

  • The Mysql part I already have, I just want to get the IP.

Show 5 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.