简体   繁体   English

Java EE TCP服务器

[英]Java EE TCP Server

I'm developing a web application in Java EE/Spring/SpringWEB. 我正在Java EE / Spring / SpringWEB中开发Web应用程序。

A part of the application needs to communicate with mobile devices through TCP/UDP (not HTTP). 应用程序的一部分需要通过TCP / UDP(不是HTTP)与移动设备进行通信。 I want that all infrastructure runs in the Java EE container (Tomcat for instance). 我希望所有基础结构都在Java EE容器(例如Tomcat)中运行。 I wonder whether there's any standard or part of the Java EE container (Tomcat) I can reuse for having a TCP Server for free? 我想知道是否可以重复使用Java EE容器(Tomcat)的任何标准或一部分以免费使用TCP Server?

I mean I do not want to implement my own TCP server which needs to be scalable/reliable and efficent. 我的意思是我不想实现自己的TCP服务器,该服务器需要可伸缩/可靠且高效。 I want to reuse as much as possible and use standards where applicable. 我想尽可能地重用并在适用的地方使用标准。

There isn't anything in Java EE, not sure about Spring. Java EE中没有任何内容,不确定Spring。 For implementing on your own, I would highly recommend using netty as the main building block for your tcp server. 为了自己实现,我强烈建议使用netty作为tcp服务器的主要构建块。

Well, Tomcat is not a true Java EE server, but rather the web servlet part of the Java EE stack. 嗯,Tomcat不是真正的Java EE服务器,而是Java EE堆栈中的Web servlet部分。 There is no real official TCP server lib included in Java EE, except the Java SE socket libraries. 除了Java SE套接字库外,Java EE中没有真正的官方TCP服务器库。 I suggest you use the open source library Apache MINA for TCP/UDP server features. 我建议您将开放源代码库Apache MINA用于TCP / UDP服务器功能。 It should work with Tomcat. 它应该与Tomcat一起使用。 A full Java EE stack (glassfish, websphere, weblogic, geronimo..) might disallow setting up TCP listeners, so be careful if you migrate from Tomcat to a full java ee stack. 完整的Java EE堆栈(glassfish,websphere,weblogic,geronimo ..)可能不允许设置TCP侦听器,因此,如果您从Tomcat迁移到完整的Java ee堆栈,请当心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM