频道栏目
首页 > 系统 > Linux > 正文
linux网络通信代码实例
2017-11-15 11:47:22         来源:咖啡色等烟雨  
收藏   我要投稿

TCP transmit control protocol

UDP usrer data protocol

linux 中网络名称和ip地址的相对应,如/etc/hosts,但这种映射只是本地机的映射

127.0.0.1       localhost
127.0.1.1       ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

DNS 域名解析器,主机中记录的DNS地址,见于/etc/resolv.conf

 Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search localdomain

linux 中服务所占的端口,见于/etc/services

# Network services, Internet style
#
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, officially ports have two entries
# even if the protocol doesn't support UDP operations.
#
# Updated from https://www.iana.org/assignments/port-numbers and other
# sources like https://www.freebsd.org/cgi/cvsweb.cgi/src/etc/services .
# New ports will be added on request if they have been officially assigned
# by IANA and used in the real-world or are needed by a debian package.
# If you need a huge list of used numbers please install the nmap package.

tcpmux      1/tcp               # TCP port service multiplexer
echo        7/tcp
echo        7/udp
discard     9/tcp       sink null
discard     9/udp       sink null
systat      11/tcp      users
daytime     13/tcp
daytime     13/udp
netstat     15/tcp
qotd        17/tcp      quote
msp     18/tcp              # message send protocol
msp     18/udp
chargen     19/tcp      ttytst source
chargen     19/udp      ttytst source
ftp-data    20/tcp
ftp     21/tcp
fsp     21/udp      fspd
ssh     22/tcp              # SSH Remote Login Protocol
ssh     22/udp
telnet      23/tcp
smtp        25/tcp      mail
time        37/tcp      timserver
time        37/udp      timserver
rlp     39/udp      resource    # resource location
nameserver  42/tcp      name        # IEN 116
whois       43/tcp      nicname
tacacs      49/tcp              # Login Host Protocol (TACACS)
tacacs      49/udp
re-mail-ck  50/tcp              # Remote Mail Checking Protocol
re-mail-ck  50/udp
domain      53/tcp              # Domain Name Server
domain      53/udp
mtp     57/tcp              # deprecated
tacacs-ds   65/tcp              # TACACS-Database Service
tacacs-ds   65/udp
bootps      67/tcp              # BOOTP server
bootps      67/udp
bootpc      68/tcp              # BOOTP client
bootpc      68/udp
tftp        69/udp
gopher      70/tcp              # Internet Gopher
gopher      70/udp
rje     77/tcp      netrjs
finger      79/tcp
http        80/tcp      www     # WorldWideWeb HTTP
http        80/udp              # HyperText Transfer Protocol
点击复制链接 与好友分享!回本站首页
上一篇:Linux socket 的编程详情讲解
下一篇:linux调试器断点的实现
相关文章
图文推荐
点击排行

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站