Merge branch 'main' into development
This commit is contained in:
@@ -8,7 +8,6 @@ const categoryConverter = new CategoryConverterUseCase({categoriesMapping});
|
|||||||
|
|
||||||
module.exports = async function app(domain){
|
module.exports = async function app(domain){
|
||||||
const category = await getCategory.execute(domain)
|
const category = await getCategory.execute(domain)
|
||||||
console.log(category)
|
|
||||||
const categoryConverted = await categoryConverter.execute(category)
|
const categoryConverted = await categoryConverter.execute(category)
|
||||||
console.log(categoryConverted)
|
console.log(categoryConverted)
|
||||||
return categoryConverted
|
return categoryConverted
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
const dgram = require('dgram');
|
const dgram = require('dgram');
|
||||||
const client = dgram.createSocket('udp4');
|
const client = dgram.createSocket('udp4');
|
||||||
|
|
||||||
const message = 'bet365.com';
|
const message = 'www.facebook.com';
|
||||||
|
|
||||||
const serverHost = 'localhost';
|
// const serverHost = '34.116.211.192';
|
||||||
const serverPort = 3000;
|
// const serverPort = 3000;
|
||||||
|
|
||||||
// const serverHost = '209.97.181.89';
|
// const serverHost = '209.97.181.89';
|
||||||
// const serverPort = 33333;
|
// const serverPort = 33333;
|
||||||
|
|
||||||
// const serverHost = 'localhost';
|
const serverHost = 'localhost';
|
||||||
// const serverPort = 41234;
|
const serverPort = 33333;
|
||||||
|
|
||||||
|
|
||||||
client.send(message, 0, message.length, serverPort, serverHost, (err) => {
|
client.send(message, 0, message.length, serverPort, serverHost, (err) => {
|
||||||
|
|||||||
@@ -26,15 +26,17 @@ server.on('message', async (msg, rinfo) => {
|
|||||||
console.log(`Server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
console.log(`Server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
||||||
|
|
||||||
const strMsg = msg.toString()
|
const strMsg = msg.toString()
|
||||||
const categories = await app(strMsg)
|
let categories = await app(strMsg)
|
||||||
|
|
||||||
let result = {}
|
let result = {}
|
||||||
|
|
||||||
|
categories = categories.map(category => parseInt(category))
|
||||||
|
|
||||||
if (categories)
|
if (categories)
|
||||||
result = {
|
result = {
|
||||||
result: categories
|
result: categories
|
||||||
}
|
}
|
||||||
|
console.log(result)
|
||||||
server.send(JSON.stringify(result), rinfo.port, rinfo.address, (err) => {
|
server.send(JSON.stringify(result), rinfo.port, rinfo.address, (err) => {
|
||||||
if (err) server.close();
|
if (err) server.close();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user