java8_api_net
网络编程1
操作ip地址
核心类 InetAddress
相关方法 getByName,getAllByName,getLocalHost
操作socket地址
由ip地址(或主机名)与端口号组成
核心类 InetSocketAddress
相关方法
package java_20180213_api_net; import java.net.InetAddress;
import java.net.InetSocketAddress; public class InetAddressDemo { public static void main(String[] args) throws Exception {
// InetAddress ia=InetAddress.getLocalHost();
// System.out.println(ia.getHostName());
// System.out.println(ia.getHostAddress()); InetAddress[] ia1=InetAddress.getAllByName("DESKTOP-NMUHAH0");
for (InetAddress inetAddress : ia1) {
System.out.println(inetAddress.getHostAddress());
}
InetAddress ia2=InetAddress.getByName("edu.51cto.com");
System.out.println("edu: "+ia2.getHostAddress()); InetSocketAddress ia3=new InetSocketAddress(80);
}
}
网络编程2
uri,url,urn的概念
java中相关的类
java.net.URI
java.net.URL
java.net.URLEncoder
java.net.URLDecoder
网络编程3
通过java api访问url的内容
网络编程4
实现tcp服务器端socket
实现tcp客户端socket
java8_api_net的更多相关文章
随机推荐
- centos7 下安装mysql教程
最近要在centos服务器上配置环境,在部署mysql的时候,碰到各种各样的问题,网上博客文章也是有各种坑,目前发现一个比较好的博客: https://blog.csdn.net/xiaomojun/ ...
- Asp.Net Core MongoDB
废话不说直接上代码: using MongoDB.Bson.Serialization.Attributes; namespace XL.Core.MongoDB { public interface ...
- Linux 系统运行命令 > 查看系统信息
查看系统运行状态 一 . 查看硬件信息 - 1. cpu信息(可以通过find,whereis,locate查出路径) #cat /proc/cpuinfo 2 . 内存信息:meminfo(可以用c ...
- KendoUi 学习笔记一
本系列主要是记录KendoUI的学习过程. KendoUi的特点有以下特点: 1. 70+UI控件 控件有DataGrids,DropDowns,Menus和Buttons,还有一些商业的控件,比如C ...
- linux运维工作内容及岗位要求
什么是Linux?大家日常使用电脑听歌.打游戏娱乐或处理日常工作时,接触到最多的就是Windows操作系统,电脑如果不安装Windows系统是无法进行娱乐和工作的,所有的软件程序都必须运行在操作系统之 ...
- OpenGL的一些名词
搬运自:https://learnopengl-cn.github.io/01%20Getting%20started/10%20Review/ 词汇表 OpenGL: 一个定义了函数布局和输出的图形 ...
- 怎么样通过php使用html5实现多文件上传?(php多图上传)
<!DOCTYPE html><html lang="zh-cn"> <head> <meta charset="utf-8&q ...
- TP5框架 nginx服务器 配置域名 隐藏index.php
server { listen ; #server_name localhost; server_name hhy.com;/**这里写自己的域名*/ #charset koi8-r; #access ...
- 《Machine Learning Yearing》读书笔记
——深度学习的建模.调参思路整合. 写在前面 最近偶尔从师兄那里获取到了吴恩达教授的新书<Machine Learning Yearing>(手稿),该书主要分享了神经网络建模.训练.调节 ...
- CSS组合设计输入框和按钮生成自定义关键字查询栏
效果图: html代码: <!DOCTYPE html> <head> <title></title> </head> <body&g ...