Answer the question
In order to leave comments, you need to log in
How to realize my small thoughts?
Good afternoon.
You need to make a program that will receive a domain name and display an IP address.
Visually, graphically, everything is ready, but the code is not.
double num1 = Float.parseFloat(jTextField1.getText()); // Записываем полученный вод домена
String num2 = Double.toString(num1); // В переменную записываем переведенный результат в String в переменную num2 Дальше нужно этот результат применить к InetAddres чтобы потом полученный результат вывести в jTextField4
Answer the question
In order to leave comments, you need to log in
On Node.js (you just have a JavaScript tag) you can do something like this
https://nodejs.org/api/dns.html
var dns = require('dns')
var express = require('express')
var cors = require('cors')
var app = express()
var url = require('url')
app.get('/get-ip/:url', cors(), function(req, res) {
var URL = req.params.url;
if (URL !== 'favicon.ico') {
dns.resolve4(URL, (err, addresses) => {
if (err) throw err;
res.send(JSON.stringify({
original: URL,
ip: addresses[0]
}))
})
}
})
var port = process.env.PORT || 8080;
app.listen(port, function() {
console.log('Node.js listening on port ' + port)
})
InetAddress address = InetAddress.getByName("www.example.com");
System.out.println(address.getHostAddress());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question