客户端服务器应用
问题描述:
<pre lang="text">
我有两个Windows窗体应用程序其中一个服务器和另一个客户端,客户端有一个允许用户输入用户名并通过的屏幕。问题是如何将用户名和密码发送到连接到数据库的服务器,并将操作结果返回给客户端。我正在使用c#.net编程http://www.codeproject.com/Questions/ask.aspx#任何建议
i have two windows form app one of them server and the other client , the client have a screen that lets the user enter the username and pass. the problem is how to send user name and password to the server that is connected to a database , and return the result of the operation to client . i am programminghttp://www.codeproject.com/Questions/ask.aspx# using c#.net any advice
答
基本上,你需要连接和基于TCP的通信,这是您需要的最低级别。它可以在几个不同级别的网络,远程处理或WCF之一上完成。
请在我过去的解决方案中查看我对这些方法的概述:
我可以将byte []发送到其他电脑 [ ^ ],
沟通b / w LAN上的两个Windows应用程序。 [ ^ ]。-SA
Basically, you need connection and communication based on TCP, which is the lowest level you need. It can be done on one of several different levels of networking, remoting or WCF.
Please see my overview of these approaches in my past solutions:
how i can send byte[] to other pc[^],
Communication b/w two Windows applications on LAN.[^].—SA
在http://oelsoft.com上试用Integra Client / Server API
Try out Integra Client/Server API at http://oelsoft.com
在Win Forms中,客户端使用WinSoc连接到服务器(反之亦然) k API。这是一个相对简单的过程。 MSDN的文档,运行Winsock客户端和服务器代码示例 [ ^ ],应该有帮助。
顺便说一下,你应该对客户端和服务器之间传递的数据进行加密。有许多方法可以实现此目的,但您必须确保在客户端和服务器之间传递的密码已加密,并且存储在数据库中的密码受到保护。
In Win Forms, the client is connected to the server (and vice-versa) using the WinSock API. It is a relatively straight forward process. MSDN's documentation, Running the Winsock Client and Server Code Sample[^], should help.
By the way, you should perform encryption on the data being passed between the client and the server. There are a number of ways to accomplish this but you must insure that the password passed between client and server is encrypted and that the password that is stored in the database is protected.