摘 要:象棋诞生于中国古代,源远流长,至今已经有三千多年里的历史,是中华人民智慧的结晶。下象棋不仅能休闲于生活,有益于提高思维能力,利于智力的发展,提高棋手的心理素质,也能培养人的大局观念。因此,很有必要培养新一代青少年对象棋的爱好,而本文也对制作象棋软件进行了研究。65922
本软件利用Microsoft Visual Studio 2012作为开发平台,采用C#语言开发,基于TCP协议,网络通信采用C/S模型,利用C#的socket封装的类进行客户端与服务器端数据的传输,在服务器端,需要不断的监听是否有客户端发送连接请求,一旦接受到请求,需要跟客户端创立起连接,在客户端,只需要发送连接请求到指定服务器,双方连接后并创建套接字即可进行数据传送跟接收,客户端每步操作都会给数据传向服务端,服务端接受到相应的数据会有相应的处理,再给处理的数据发送给用户。本软件利用这种互相传送数据的方式实现了用户注册,登陆,游戏大厅,选择座位,对弈,悔棋,认输,聊天,判断输赢等功能。采用跟SQL Server数据库连接,突破动态数据交互,创建游戏大厅,实现走棋等技术难点,实现了交互性较好的网络象棋对弈系统。
毕业论文关键词:中国象棋,C#,socket
Abstract:Born in the ancient times, chess has a long history of more than three thousand
years hitherto. It is the wisdom crystallization of all our Chinese people. Chess is not only a way of entertainment in life, but a game beneficial to the thinking ability and intelligence development. It improves our psychological quality and, moreover, cultivate in us
chess players a wider perspective. Therefore, it is necessary to develop the interest of the
teenagers of a new generation in chess, and this paper also studies the production of chess
software.
This software takes Mcrosoft Visual Studio 2012 as its platform,employs the C# language
and pratices the TCP protocol, uses C/S mode in network commuciations and transmits data
between users and servers through encapsulation technology of socket with C#.At servers
terminal, continuous monitoring is definite. Once receiving request from users, the connection
must be made between users and servers. At users terminal, the users just need to send request to appointed servers, the data will be transmit after the socket connection. Every step the users
make, the related data will be sent to servers which will deal with them and send them back to users. This software succeeds in realizing the users registration, loading, choosing seats in game
lobby, playing games, quiting games, judging the result of games and chatting. By connecting
with SQL Server database, making breakthrough in DDE and moving chessman as well as
establishing game lobby,the software makes progress in better interactive internet chess system.
Key words: chess, c#,socket
目 录
1 前言 4
1.1研究背景 4
1.2象棋规则 4
1.3研究现状及发展趋势 5
1.4课题开发环境及目标 5
2 网络编程储备 5
2.1 多线程 5
2.2 通信模型 6
2.3 套接字 6
2.4 网络流