java指定网卡通信,Java中的网络通信选项(客户端/服务器)

There is RMI, which I understand to be relatively fragile, direct Socket connections, which is rather low level, and Strings, which while about as solid as it gets seems to be the metaphorical PHP.

What less basic options do I have for internet based Client/Server communication ? What are the advantages/disadvantages ? What are some concerns I should take into consideration ? Third party library suggestions are fine, as long as they stay platform independent (i.e. no restrictive native code).

Looking for options, not a definite answer, so I'm leaving the details of my own requirements blank.

解决方案

As you specified "internet based", there's a lot to be said for an HTTP-based, RESTful approach (I've highlighted some concerns you should consider):

Pros:

You can use/abuse one of the myriad web-tier frameworks for the server side (e.g. Spring MVC, Play!)

The low-level work has been done on client-side (Apache HTTPClient)

Plain-text protocol is easy to debug on the wire

Tons of tools available to help you debug the interactions (e.g. SoapUI) - you can pretend to be client OR server and so develop in isolation until the other end is ready

Using a well-known port (80/443) makes punching through corporate firewalls a whole lot easier

Cons:

There's a fairly major assumption that the server will be doing the lion's share of the work - if your model is "inverted" then it might not make much sense to be RESTful

Raw performance will be lower than a bits-on-the-wire socket-based approach

Plain-text protocol is easy to sniff on the wire (SSL can remedy this)

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值