inet_ntop没有返回正确的IP地址

时间:2019-05-12 17:06:26

标签: c networking dns inet-ntop

我需要获取api.openweathermap.org的IP地址。

这是我尝试过的:

import { Injectable } from '@angular/core';
import { Product } from './product.model';
import { HttpClient } from "@angular/common/http";

@Injectable({
  providedIn: 'root'
})
export class ProductService {

  formData : Product;
  list : Product[];
  readonly rootURL = "http://localhost:57319/api";

  constructor(private http : HttpClient) { }

  postProduct(formData : Product){
   return this.http.post(this.rootURL+'/Product',formData);    
  }

  refreshList(){
    this.http.get(this.rootURL+'/Product')
    .toPromise().then(res => this.list = res as Product[]);
  }

  putProduct(formData : Product){
    return this.http.put(this.rootURL+'/Product/'+formData.ProductID,formData);

   }

   deleteProduct(id : number){
    return this.http.delete(this.rootURL+'/Product/'+id);
  }
}

输出为随机字符串,例如“ ^ jk5”,应为82.196.7.246

0 个答案:

没有答案
相关问题