分布式系统之Socket编程

demo参考

1.Introduction

Because of Increasing Demand for Internet Applications, Object-oriented Java technologies—Sockets, threads, RMI, clustering, Web services—have emerged as leading solutions for creating portable, efficient, and maintainable large and complex Internet applications.
在这里插入图片描述

2.Networking Basics

  • Physical/Link Layer
    Functionalities for transmission of signals representing a stream of data from one computer to another

  • Internet/Network Layer
    IP (Internet Protocols) – a packet of data to be addressed to a remote computer and delivered

  • Transport Layer
    Functionalities for delivering data packets to a specific process on a remote computer.
    TCP (Transmission Control Protocol):
    TCP (Transmission Control Protocol) is a connection-oriented communication protocol that provides a reliable flow of data between two computers. like HTTP, FTP, Telnet.

    UDP (User Datagram Protocol):
    UDP (User Datagram Protocol) is a connectionless communication protocol that sends independent packets of data, called datagrams, from one computer to another with no guarantees about arrival or order of arrival. like Ping, Live streaming (event/sports broadcasting).

    – Programming Interface: Sockets

  • Applications Layer
    Message exchange between standard or user applications:
    HTTP, FTP, Telnet, Skype,…

3.Understanding Ports and Sockets

3.1 Ports

The TCP and UDP protocols use ports to map incoming data to a particular process running on a computer.

  • Port is represented by a positive (16-bit) integer value
  • Some ports have been reserved to support common/well known services:
    – ftp 21/tcp
    – telnet 23/tcp
    – smtp 25/tcp
    – login 513/tcp
  • User-level processes/services generally use port number value >= 1024
3.2 Sockets
concept
  • Sockets provide an interface for programming networks at the transport layer
  • Network communication using Sockets is very much similar to performing file I/O
    – In fact, socket handle is treated like file handle.
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值