RPC and serialization

Socket and RPC implement.

Implement can be seen there.

Socket

using TCP

  • TCP (Transmission Control Protocol) is a standard that defines how to establish and maintain a network conversation via which application programs can exchange data.

In Java

  • need java.net.Socket and java.net.ServerSocket
  • create Server and Client Models

Using UDP

  • UDP (User Datagram Protocol) is an alternative communications protocol to Transmission Control Protocol (TCP) used primarily for establishing low-latency and loss-tolerating connections between applications on the internet.

In Java

  • need java.net.*
  • using DatagramPacket and DatagramSocket

RPC

  • Remote Procedure Call,a pro
    • computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (local) procedure call, without the programmer explicitly coding the details for the remote interaction.
    • Procedure:Client
    • Callee procedure:Server
    • Function or Method:Service
  • call remote function (Method) Behavior like local call
  • 53727961116
  • How to call function using function name?

Server

  • need a thread of this method to wait for response from client(service)
  • need the class implement
  • need a interface to register this service

Client

  • need the interface of class needed
  • need a new Proxy Instance to proxy this method for client

Serialization

Serialization is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database, or a file.

module

  • IDL(Interface description language)文件
    • 参与通讯的各方需要对通讯的内容需要做相关的约定
  • IDL Compiler
    • 将IDL文件转换成各语言对应的动态库
  • Stub/Skeleton Lib
    • 负责序列化和反序列化的工作代码
  • Client/Server
    • 指的是应用层程序代码
  • 底层协议栈和互联网

Protocol

  • XML
  • JSON
  • Protobuf
  • Thrift
  • Avro

Reference

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值