简单的客户端/服务器应用程序

问题描述:

你好.
我想使用Windows窗体应用程序在C#中开发一个简单的客户端/服务器应用程序.

例如,当单击客户端中的按钮时,它将获得计算机的IP地址,并将该IP地址传递给服务器.服务器会在另一个窗口中显示它.

我该怎么做?

谢谢.

Hello.
I want to develop a simple client/server application in C#, using Windows Form Application.

For example, when the button in client is clicked, it will get the IP address of the machine, and pass the IP address to the server. The server will display it, of course in another window.

How would I be able to do that?

Thanks.

您可以通过简单的套接字连接来实现.你可以看到它.

C#中的套接字 [ http://www.c-sharpcorner.com/uploadfile/dottys/socketprogdtrp112220050050230am/socketprogdtrp.aspx [ ^ ]

http://www.csharp-examples.net/socket-send-receiv [ ^ ]
You can do it by simple socket connection. you can see it.

Sockets in C#[^]

http://www.c-sharpcorner.com/uploadfile/dottys/socketprogdtrp11222005023030am/socketprogdtrp.aspx[^]

http://www.csharp-examples.net/socket-send-receiv[^]


您还可以看到此链接以获取您的计算机的IP地址.

http://www.csharp-examples.net/local-ip/ [ http://netomatix.com/MachineIp.aspx [
You also can see this link for get the IP address of your machine.

http://www.csharp-examples.net/local-ip/[^]
http://netomatix.com/MachineIp.aspx[^]