简体   繁体   English

在Java客户端和.NET服务器之间建立通信

[英]Establishing communication between Java client and .NET server

I would like to create a server using .NET and Java client (Android application). 我想使用.NET和Java客户端(Android应用程序)创建服务器。

The client will be connected to the server through mobile network so it's impossible to use tcp socket for two-way communication. 客户端将通过移动网络连接到服务器,因此不可能使用tcp套接字进行双向通信。

I would like to develop a logic for client login: 我想为客户端登录开发一种逻辑:

The client sends username and password to the server and server replies (connected/not connected). 客户端向服务器发送用户名和密码,服务器回复(已连接/未连接)。 Then if client is connected it starts sending data stream using tcp sockets. 然后,如果客户端已连接,它将开始使用tcp套接字发送数据流。

So far I have looked at some of the tutorials for Java/.Net interoperability and remoting but still haven't found the solution for login logic described above. 到目前为止,我已经看过一些有关Java / .Net互操作性和远程处理的教程,但仍然没有找到上述登录逻辑的解决方案。

I would really appreciate any suggestion on how to create a logic for login or any good tutorial recommendation. 我真的很感谢关于如何创建登录逻辑的任何建议或任何好的教程建议。

Thanks! 谢谢!

Not having ever coded against Android I don't really know it's limitations. 从未针对Android进行编码,我真的不知道它的局限性。 However, I'd say your best bet is probably going to be using HTTP communication through soapy or restful webservices. 但是,我想您最好的选择可能是通过肥皂性或宁静的Web服务使用HTTP通信。

I'd recommend looking into WCF for your .Net server side components. 我建议您对WCF进行.Net服务器端组件的检查。 This will allow you to deploy either a Soap connector or a Rest connector or both. 这将允许您部署Soap连接器或Rest连接器,或同时部署这两者。 Then you will likely be able to use standard HTTP basic authentication for your login logic. 这样您就可以对登录逻辑使用标准的HTTP基本身份验证。

With a Soap or Rest based service, you'll be able to use any of the numerous soap libraries for Java or you can do all of the HTTP stuff manually using Java's built in libraries. 借助基于Soap或Rest的服务,您将能够使用Java的众多肥皂库中的任何一个,或者可以使用Java的内置库手动完成所有HTTP工作。

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

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