---
title: "获取本地与服务器地址"
author: "sgp420"
date: "2014-03-21T10:25:48Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2014-03-21T10:25:48Z"
id: 2034376
url: "https://sgp420.iteye.com/blog/2034376"
---

记录以备忘记

 

1、InetAddress ip3 = InetAddress.getByName("tt"); //tt为计算机名称

     ip4 = ip3.getHostAddress(); //获取服务器地址

 

 

2、InetAddress.getLocalHost().getHostAddress()//获取本地地址