Description: Socket实现客户端与服务端通信源码
程序说明:
开发工具:Visual Studio 2005
本程序演示了Socket通信的基本原理,非常适合初学者。程序分为两部分:服务器端与客户端,实际上客户端也可以充当服务器端,本程序两端的区别在于服务器端要发送数据必须要有客户端的连接作为基础,而客户端没有此限制。希望本示例能够给大家学习SOCKET带来帮助。
注意事项:
1.运行程序之前请先设定好服务器端的IP地址,在客户端程序中的设置-》服务器IP设置,可更改为具体服务器的IP地址,否则程序将不能正常运行
2.运行服务器端程序,运行后服务器端会自动以本地的IP地址与预设的端口号开启监听。本程序可以在局域网中实现简单的通信,但是只能向服务器发送数据,然后服务器向指定的客户端发送数据。大家可以在此基础上对程序进行更改,让局域网上的每个用户都可以聊天。
-Socket to achieve client and server communication source
Program Description:
Development Tools: Visual Studio 2005
This program demonstrates the basic principles of Socket Communications, is suitable for beginners. Program is divided into two parts: the server side and client side, in fact, clients can also act as a server-side, the difference between both ends of this procedure is to send the data server must have a connection as a basis for the client, but client does not have this limitation. Hope this example will be helpful for everyone to learn SOCKET.
Note:
1. Run the program before you set up the IP address of the server, the client program settings- the "server IP settings, change the IP address for a specific server, otherwise the program will not run
2. Run the server-side program will run automatically after the server s IP address and the default local port number of open listening. This procedure can be implemented in a simple local area network communications, but Platform: |
Size: 90112 |
Author:谢巍 |
Hits: