资源简介
游戏服务端+模拟游戏客户端游戏服务端+模拟游戏客户端

代码片段和文件信息
using Newtonsoft.Json;
using Ser_Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Management;
using System.Net;
using System.Net.Sockets;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace ClientForm
{
///
/// 客户端总汇总
///
public class Cli_Logic : Form
{
private TcpClient client = null;
private StreamWriter sw;
private StreamReader sr;
//是否正常退出接收线程
private bool normalExit = false;
public Cli_Logic()
{
try
{
this.Load += Cli_baseForm_Load;
this.FormClosing += Cli_baseForm_FormClosing;
client = new TcpClient();
client.Connect(IPAddress.Parse(NetWorkFile._ip) NetWorkFile._port);
//获取网络流
NetworkStream netStream = client.GetStream();
sr = new StreamReader(netStream System.Text.Encoding.UTF8);
sw = new StreamWriter(netStream System.Text.Encoding.UTF8);
GetSreverMsg();
}
catch
{
}
}
void Cli_baseForm_FormClosing(object sender FormClosingEventArgs e)
{
System.Environment.Exit(0);
}
void Cli_baseForm_Load(object sender EventArgs e)
{
Control.CheckForIllegalCrossThreadCalls = false;
}
//向服务器发送内容
/// 向服务器发送数据
public void SendToServer(string str)
{
try
{
sw.WriteLine(Encryption(str));
sw.Flush();
}
catch
{
//发送数据失败
}
}
//从服务器获取内容
public void GetSreverMsg()
{
Thread threadReceive = new Thread(new ThreadStart(ReceiveData));
threadReceive.Start();
}
///
/// 获取返回到客户端的模板
///
///
private string Get_Return_ClientModel_Str(T model TcpTypeEnum tcpType)
{
Model_CheckTCPType t_model = new Model_CheckTCPType();
t_model.TcpType = tcpType;
t_model.Context = ModelSerialize(model);
return ModelSerialize(t_model);
}
///
/// 服务器发送过来的数据
///
private void ReceiveData()
{
bool exitWhile = false;
while (exitWhile == false)
{
string receiveString = null;
try
{
receiveString = Decrypt(sr.ReadLine());
if (receiveString[0] != ‘{‘)
{
receiveS
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 144 2017-07-23 18:20 test\ClientForm\app.config
文件 70656 2017-08-07 09:23 test\ClientForm\bin\Debug\ClientForm.exe
文件 144 2017-07-23 18:20 test\ClientForm\bin\Debug\ClientForm.exe.config
文件 85504 2017-08-07 09:23 test\ClientForm\bin\Debug\ClientForm.pdb
文件 22472 2017-07-28 15:03 test\ClientForm\bin\Debug\ClientForm.vshost.exe
文件 144 2017-07-23 18:20 test\ClientForm\bin\Debug\ClientForm.vshost.exe.config
文件 490 2012-06-06 02:06 test\ClientForm\bin\Debug\ClientForm.vshost.exe.manifest
文件 363008 2012-02-08 17:07 test\ClientForm\bin\Debug\Newtonsoft.Json.Net35.dll
文件 36 2017-08-07 10:08 test\ClientForm\bin\Debug\ServerSet.ini
文件 32768 2017-08-07 09:23 test\ClientForm\bin\Debug\Ser_Model.dll
文件 17920 2017-08-07 09:23 test\ClientForm\bin\Debug\Ser_Model.pdb
文件 4420 2017-07-28 20:53 test\ClientForm\ClientForm.csproj
文件 26546 2017-08-03 08:17 test\ClientForm\Cli_Logic.cs
文件 5817 2017-07-24 08:28 test\ClientForm\MeGoBack.resx
文件 3944 2017-08-07 09:23 test\ClientForm\obj\Debug\ClientForm.csproj.FileListAbsolute.txt
文件 980 2017-08-07 09:23 test\ClientForm\obj\Debug\ClientForm.csproj.GenerateResource.Cache
文件 13118 2017-08-07 09:23 test\ClientForm\obj\Debug\ClientForm.csprojResolveAssemblyReference.cache
文件 70656 2017-08-07 09:23 test\ClientForm\obj\Debug\ClientForm.exe
文件 85504 2017-08-07 09:23 test\ClientForm\obj\Debug\ClientForm.pdb
文件 180 2017-08-07 09:23 test\ClientForm\obj\Debug\ClientForm.Pla
文件 180 2017-08-07 09:23 test\ClientForm\obj\Debug\ClientForm.Properties.Resources.resources
文件 58584 2017-07-31 20:19 test\ClientForm\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7077 2017-08-01 15:37 test\ClientForm\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 4608 2017-07-24 07:24 test\ClientForm\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 16230 2017-08-01 15:56 test\ClientForm\Pla
文件 144716 2017-07-29 14:29 test\ClientForm\Pla
文件 5817 2017-07-29 14:29 test\ClientForm\Pla
文件 476 2017-07-21 14:20 test\ClientForm\Program.cs
文件 1350 2017-07-21 14:19 test\ClientForm\Properties\AssemblyInfo.cs
文件 2860 2017-07-23 18:20 test\ClientForm\Properties\Resources.Designer.cs
............此处省略263个文件信息
- 上一篇:roll a ball源码
- 下一篇:硬盘物理序列号修改专家 v2.0 中文免费版
相关资源
- flash3.0小游戏
- Scrach 欢乐狙击手.sb2
- FTP课程设计(服务端+客户端)
- WPF USB 网络 串口 通信软件
- B/S 网上订餐系统
- linux应用层的华容道游戏源代码
- 教室管理系统.rar
- 小鸡快跑游戏.
-
分别适用于.NET fr
amework 2.0和4.0的E - 汽车租赁系统............................
- [易语言]游戏多开例程
- 贪吃蛇游戏设计(汇编语言)
- 德卡D8读写器关于读写感应卡的一些代
- VC 游戏编程—附源代码
- halcon 测量助手
- C 纸牌游戏——21点
- 分享 mud 文字游戏 源码
- 图片存储到数据库保存二进制文件并
- c 制作的RPG小游戏
- 五子棋游戏实现悔棋功能
- 用Socket写的简易FTP服务器和客户端
- 找不同FLASH游戏源码
- 企业销售管理信息系统(全套)
- socket小工具(可方便建立TCP UDP的soc
- planeGame飞机游戏
- 串口操作类(justinio)
- 拼图游戏源代码 powerbuilder 9.0实例
- 解决WPE进不了游戏的最佳方法(闭屏
- 基于Petri网的工作流(完整的原创源代
- 选择题自动考试系统
评论
共有 条评论