-
client-server
多协议文件传输c/s网络应用设计与实现,程序用 TCP/UDP 两个协议模拟多协议服务器。首先服务器端要将两种协议的套接字创建好,并且监听 TCP 端口的连接。必要时使用select函数来进行多连接处理和非阻塞处理。而客户端直接可以按照发送的地址和端口号来进行通讯。
首先要运行服务器端,服务器会监听 TCP 端口。然后运行客户端,根据事先设定好的 IP和端口,就可以进行连接传输数据了。
程序实现的关键步骤:
以TCP协议为例
服务器端:
1.创建套接字;2.绑定端口;3.进入无穷的循环;4.接收请求;5.处理请求;6.应答。
客户端:
1.找到服务器的IP地址和协议的端口号;2.创建套接字;3.确定连接需要任意的,没有使用的端口号允许TCP去选择一个;4.将套接字和服务器连接;5.使用应用层协议和服务器交互;6.关闭连接。
(Multi-protocol file transfer c/s network application design and implementation of programs simulate multi-protocol server with TCP/UDP both protocols. First socket server to create a good two protocols, TCP port and listens for connections. If necessary, use the function to handle multiple connections and non-blocking treatment. And the client can follow directly address and port number to communicate.
First run on the server side, the server listens on TCP port. Then run the client, according to pre-configured IP and port, you can connect the data transmission.
The key step program implementation:
In TCP protocol as an example
Service-Terminal:
1. Create a socket 2 bound port 3 enter an infinite loop 4. receiving a request 5. processing requests 6 response.
Clients:
1. Locate the server s IP address and protocol port number 2 creates a socket 3 connections need to determine arbitrary, unused port allows TCP to choose a 4 and the socket server connections 5 using appli)
- 2016-07-11 10:19:07下载
- 积分:1
-
sudoku
逻辑推理,通过程序设计实现简单的逻辑推理功能
(logic reasoning)
- 2010-05-07 16:49:51下载
- 积分:1
-
yuanchengkongzhi_VC
说明: 这是一个远程控制的源代码,该代码本身简单小巧,使新手上路的好材料。(This is a remote control of source code, the code itself, a simple compact, so that a good material novice road.)
- 2008-09-20 08:36:30下载
- 积分:1
-
Beidou_satellite
北斗卫星产生伪随机码的程序,用以模拟输出伪随机序列(Beidou satellite program generates pseudo-random code to simulate the output of the pseudo-random sequence)
- 2021-04-19 09:58:51下载
- 积分:1
-
Exceptional-cPP
Exceptional c++中文版,指导c++程序员写出高效整洁的代码(Exceptional c++ Chinese version of the guide c++ programmers to write efficient code clean)
- 2013-08-19 16:24:48下载
- 积分:1
-
poj3941
poj 3941
Hideyuki is allowed by his father Ujisato some 1000 yen bills every month for his pocket money. In the first day of every month, the number of bills is decided as follows. Ujisato prepares n pieces of m-sided dice and declares the cutback k. Hideyuki rolls these dice. The number of bills given is the sum of the spots of the rolled dice decreased by the cutback. Fortunately to Hideyuki, Ujisato promises him to give at least one bill, even if the sum of the spots does not exceed the cutback. Each of the dice has spots of 1 through m inclusive on each side, and the probability of each side is the same.
In this problem, you are asked to write a program that finds the expected value of the number of given bills. (poj 3941 Hideyuki is allowed by his father Ujisato some 1000 yen bills every month for his pocket money. In the first day of every month, the number of bills is decided as follows. Ujisato prepares n pieces of m-sided dice and declares the cutback k. Hideyuki rolls these dice. The number of bills given is the sum of the spots of the rolled dice decreased by the cutback. Fortunately to Hideyuki, Ujisato promises him to give at least one bill, even if the sum of the spots does not exceed the cutback. Each of the dice has spots of 1 through m inclusive on each side, and the probability of each side is the same. In this problem, you are asked to write a program that finds the expected value of the number of given bills.)
- 2013-07-16 20:45:28下载
- 积分:1
-
USB-ch375-chip-sample-program
一个基于USB CH375芯片的样例程序(A chip-based USB CH375 sample program)
- 2011-08-12 13:53:19下载
- 积分:1
-
zbcpe730
BCGPEdit(BCGSoft Professional Editor)是一款MFC(微软基础类)扩展库,用于在基于MFC的程序中加入高级编辑控制。编辑控制支持高亮度语法,外轮廓以及智能感应(BCCPEdit(BCGSoft Professional Editor) is MFC(microsoft fundamental class)extended library,and is used in adding advanced edit control into program based MFC. Edit control has the funtion of highlight syntex, outline and intelligence inducting and so on.)
- 2005-06-01 14:15:18下载
- 积分:1
-
medo
设X[ 0 : n - 1]和Y[ 0 : n – 1 ]为两个数组,每个数组中含有n个已排好序的数。找出X和Y的2n个数的中位数。 编程任务 利用分治策略试设计一个O (log n)时间的算法求出这2n个数的中位数。 数据输入 由文件input.txt提供输入数据。文件的第1行中有1个正整数n(n<=200),表示每个数组有n个数。接下来的两行分别是X,Y数组的元素。结果输出 程序运行结束时,将计算出的中位数输出到文件output.txt中(Let X [0: n- 1] and Y [0: n- 1] for the two arrays, each array containing the n number has been sorted. 2n X and Y to identify the number of digits. programming tasks using the divide and conquer strategy try to design an O (log n) time algorithm to calculate this median number 2n. Data input by the input data provided input.txt file. The first line in the file has a positive integer n (n < = 200), that there are n numbers of each array. The next two lines are the X, Y array elements. The end result is output program runs, the calculated median output to file output.txt)
- 2021-03-22 16:29:16下载
- 积分:1
-
Ri230-v1
c++ 利用ADO操作数据库,供初学数据库编程的人参考(c++ to operate the database by ADO)
- 2010-12-04 20:49:35下载
- 积分:1