如何使用java nio编写完整的服务器客户端通信

时间:2022-08-26 19:54:27

I am new to java NIO. I have to write a simple server client communication program using Java NIO.

我是java NIO的新手。我必须使用Java NIO编写一个简单的服务器客户端通信程序。

Is there any sample programs or any link where can I go for this?

是否有任何示例程序或任何链接我可以在哪里进行此操作?

5 个解决方案

#1


4  

You might give a look at Apache Mina. If you only want to learn java NIO it might me a little to hard to grasp.

你可以看看Apache Mina。如果你只想学习java NIO,我可能会有点难以理解。

#2


25  

Apache Mina
http://mina.apache.org
Apache MINA is a network application framework which helps users develop high performance and high scalability network applications easily.

Apache Mina http://mina.apache.org Apache MINA是一个网络应用程序框架,可以帮助用户轻松开发高性能和高扩展性的网络应用程序。

xSocket
http://xsocket.org/
xSocket is an easy to use NIO-based library to build high performance, highly scalable network applications.

xSocket http://xsocket.org/ xSocket是一个易于使用的基于NIO的库,用于构建高性能,高度可扩展的网络应用程序。

JBoss Netty
http://netty.io/
The Netty project is an effort to provide an asynchronous event-driven network application framework and tools for rapid development of maintainable high performance and high scalability protocol servers and clients.

JBoss Netty http://netty.io/ Netty项目旨在提供异步事件驱动的网络应用程序框架和工具,以便快速开发可维护的高性能和高可伸缩性协议服务器和客户端。

Sun MicroSystem's Grizzly
https://grizzly.java.net/
The Grizzly framework has been designed to help developers to take advantage of the Java NIO API. Grizzly goals is to help developers to build scalable and robust servers using NIO.

Sun MicroSystem的Grizzly https://grizzly.java.net/ Grizzly框架旨在帮助开发人员利用Java NIO API。 Grizzly的目标是帮助开发人员使用NIO构建可扩展且强大的服务器。

NIO Framework
http://nioframework.sourceforge.net
The NIO Framework is a library on top of NIO that hides most of the complexity of plain NIO. With the NIO Framework you can implement high-performance Java network applications without having to deal with all the nasty details of NIO.

NIO框架http://nioframework.sourceforge.net NIO框架是一个基于NIO的库,它隐藏了普通NIO的大部分复杂性。使用NIO Framework,您可以实现高性能的Java网络应用程序,而无需处理NIO的所有令人讨厌的细节。

QuickServer
http://www.quickserver.org
QuickServer is an open source Java library/framework for quick creation of robust multi-client TCP server applications. QuickServer provides an abstraction over the ServerSocket, Socket and other network and input output classes and it eases the creation of powerful network servers.

QuickServer http://www.quickserver.org QuickServer是一个开源Java库/框架,用于快速创建健壮的多客户端TCP服务器应用程序。 QuickServer提供了对ServerSocket,Socket和其他网络和输入输出类的抽象,并简化了强大的网络服务器的创建。

#3


1  

Have a look in your JDK under the directory called sample

在名为sample的目录下查看JDK

#4


0  

I beleive you should take a look on Apache HttpComponents if your applcation uses HTTP, of course. There are several examples provided within downloadable library archive. Note that httpcore, httpcore-nio and httpclient are part of the project.

我相信如果您的应用程序使用HTTP,您应该查看Apache HttpComponents,当然。可下载的库存档中提供了几个示例。请注意,httpcore,httpcore-nio和httpclient是项目的一部分。

Cheers.

干杯。

#5


0  

You should look at the online tutorials available. Building Highly Scalable Servers with Java NIO looks particularly relevant.

您应该查看可用的在线教程。使用Java NIO构建高度可扩展的服务器看起来特别相关。

IBM has a tutorial (registration required) whilst Sun has some simple examples of the different facilities of NIO (not just client/server APIs)

IBM有一个教程(需要注册),而Sun有一些简单的NIO设施示例(不仅仅是客户端/服务器API)

#1


4  

You might give a look at Apache Mina. If you only want to learn java NIO it might me a little to hard to grasp.

你可以看看Apache Mina。如果你只想学习java NIO,我可能会有点难以理解。

#2


25  

Apache Mina
http://mina.apache.org
Apache MINA is a network application framework which helps users develop high performance and high scalability network applications easily.

Apache Mina http://mina.apache.org Apache MINA是一个网络应用程序框架,可以帮助用户轻松开发高性能和高扩展性的网络应用程序。

xSocket
http://xsocket.org/
xSocket is an easy to use NIO-based library to build high performance, highly scalable network applications.

xSocket http://xsocket.org/ xSocket是一个易于使用的基于NIO的库,用于构建高性能,高度可扩展的网络应用程序。

JBoss Netty
http://netty.io/
The Netty project is an effort to provide an asynchronous event-driven network application framework and tools for rapid development of maintainable high performance and high scalability protocol servers and clients.

JBoss Netty http://netty.io/ Netty项目旨在提供异步事件驱动的网络应用程序框架和工具,以便快速开发可维护的高性能和高可伸缩性协议服务器和客户端。

Sun MicroSystem's Grizzly
https://grizzly.java.net/
The Grizzly framework has been designed to help developers to take advantage of the Java NIO API. Grizzly goals is to help developers to build scalable and robust servers using NIO.

Sun MicroSystem的Grizzly https://grizzly.java.net/ Grizzly框架旨在帮助开发人员利用Java NIO API。 Grizzly的目标是帮助开发人员使用NIO构建可扩展且强大的服务器。

NIO Framework
http://nioframework.sourceforge.net
The NIO Framework is a library on top of NIO that hides most of the complexity of plain NIO. With the NIO Framework you can implement high-performance Java network applications without having to deal with all the nasty details of NIO.

NIO框架http://nioframework.sourceforge.net NIO框架是一个基于NIO的库,它隐藏了普通NIO的大部分复杂性。使用NIO Framework,您可以实现高性能的Java网络应用程序,而无需处理NIO的所有令人讨厌的细节。

QuickServer
http://www.quickserver.org
QuickServer is an open source Java library/framework for quick creation of robust multi-client TCP server applications. QuickServer provides an abstraction over the ServerSocket, Socket and other network and input output classes and it eases the creation of powerful network servers.

QuickServer http://www.quickserver.org QuickServer是一个开源Java库/框架,用于快速创建健壮的多客户端TCP服务器应用程序。 QuickServer提供了对ServerSocket,Socket和其他网络和输入输出类的抽象,并简化了强大的网络服务器的创建。

#3


1  

Have a look in your JDK under the directory called sample

在名为sample的目录下查看JDK

#4


0  

I beleive you should take a look on Apache HttpComponents if your applcation uses HTTP, of course. There are several examples provided within downloadable library archive. Note that httpcore, httpcore-nio and httpclient are part of the project.

我相信如果您的应用程序使用HTTP,您应该查看Apache HttpComponents,当然。可下载的库存档中提供了几个示例。请注意,httpcore,httpcore-nio和httpclient是项目的一部分。

Cheers.

干杯。

#5


0  

You should look at the online tutorials available. Building Highly Scalable Servers with Java NIO looks particularly relevant.

您应该查看可用的在线教程。使用Java NIO构建高度可扩展的服务器看起来特别相关。

IBM has a tutorial (registration required) whilst Sun has some simple examples of the different facilities of NIO (not just client/server APIs)

IBM有一个教程(需要注册),而Sun有一些简单的NIO设施示例(不仅仅是客户端/服务器API)