基于Linux多线程技术的网络并发编程及应用研究  被引量:11

Research on Network Concurrent Programming Based on Linux Multi-Thread Technology and Its Application

在线阅读下载全文

作  者:申时全[1] 

机构地区:[1]广东科技学院计算机系,东莞523000

出  处:《现代计算机》2016年第21期65-70,共6页Modern Computer

摘  要:针对网络环境下Socket机制以及Linux对Socket应用接口的支持,探讨基于Linux系统C语言多线程技术的网络并发编程问题。设计并实现C/S方式模拟4人掷骰子游戏的胜率统计程序,设计客户端程序和服务器端程序,服务器程序接收客户端游戏数据,决定胜负关系,将结果传回客户端,统计游戏中每个人获胜的次数,从而获得游戏胜率统计。客户端应用程序使用伪随机数生成函数获得每次掷骰子的点数,每个客户端通过相同策略获取"叫点数"。程序中使用Linux信号量实现线程间的同步关系。Aiming at the support of Socket mechanism and Socket to Linux application interface in network environment, discusses the network con-current programming problem of C language based on Linux system. Designs and realizes the simulation mode of C/S and 4 dice game winning statistical procedures, designs the client and server-side program, server program receive the game client data, decides the outcome of the relationship, results are returned to the client, winning each person in the game statistics the number of to obtain game win-ning percentage and statistics. The client application uses the pseudo random number generating function to get the number of each throw dice; each client gets "call points" by the same strategy. Uses Linux Semaphore in the program to achieve the synchronization between threads.

关 键 词:多线程 网络并发编程 伪随机数 游戏胜率统计 

分 类 号:TP311.1[自动化与计算机技术—计算机软件与理论] TP316.81[自动化与计算机技术—计算机科学与技术]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象