system

c# socket udp广播

时光毁灭记忆、已成空白 提交于 2020-03-22 05:46:18
一、广播消息   由于Tcp是有连接的,所以不能用来发送广播消息。发送广播消息,必须用到Udp,Udp可以不用建立连接而发送消息。广播消息的目的IP地址是一种特殊IP地址,称为广播地址。广播地址由IP地址网络前缀加上全1主机后缀组成,如:192.168.1.255是192.169.1.0这个网络的广播地址;130.168.255.255是130.168.0.0这个网络的广播地址。向全部为1的IP地址(255.255.255.255)发送消息的话,那么理论上全世界所有的联网的计算机都能收得到了。但实际上不是这样的,一般路由器上设置抛弃这样的包,只在本地网内广播,所以效果和向本地网的广播地址发送消息是一样的。   利用udp广播可以实现像cs中建立服务器后,客户端可以收到服务器消息从而进行连接。 二、服务端 开启线程不断广播自己ip地址等信息,等待客户端接收 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Net; 6 using System.Net.Sockets; 7 using System.Threading; 8 using System.Threading.Tasks; 9 10 namespace

你得学会并且学得会的Socket编程基础知识

偶尔善良 提交于 2020-03-22 03:47:58
这一篇文章,我将图文并茂地介绍Socket编程的基础知识,我相信,如果你按照步骤做完实验,一定可以对Socket编程有更好地理解。 本文源代码,可以通过这里下载 http://files.cnblogs.com/chenxizhang/SocketWorkshop.rar 第一步:创建解决方案 第二步:创建服务端程序 这里可以选择“Console Application”这个类型,比较方便调试 然后编写如下代码,实现服务器的基本功能 using System; using System.Collections.Generic; using System.Linq; using System.Text; //额外导入的两个命名空间 using System.Net.Sockets; using System.Net; namespace SocketServer { class Program { /// <summary> /// Socket Server 演示 /// 作者:陈希章 /// </summary> /// <param name="args"></param> static void Main(string[] args) { //创建一个新的Socket,这里我们使用最常用的基于TCP的Stream Socket(流式套接字) var socket = new

System services not available to Activities before onCreate()

我是研究僧i 提交于 2020-03-22 00:01:39
System services not available to Activities before onCreate() 在 MainActivity中定义如下变量并实例化导致。 LocationManager mgr=(LocationManager)getSystemService(Context.LOCATION_SERVICE); 此服务需要激活系统服务。, 解决方法:把此类变量的实例化工作放到MainActivity的OnCreate函数里面。 07-19 04:09:45.499: E/AndroidRuntime(5394): FATAL EXCEPTION: main 07-19 04:09:45.499: E/AndroidRuntime(5394): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{myApp.securitycore.com.comsecuritycoremyApp/myApp.securitycore.com.comsecuritycoremyApp.MainActivity}: java.lang.IllegalStateException: System services not available to Activities before

IBM ServerGuide引导盘全系列下载网址

强颜欢笑 提交于 2020-03-21 19:47:54
IBM ServerGuide引导盘全系列下载网址 官网链接 https://www.ibm.com/support/home/docdisplay?lndocid=SERV-GUIDE v9.30 for Windows Server 2012 only For Windows Server 2008 and 2003 use v9.30 below IBM BladeCenter HS22 (7870, 1936, 7809, 1910) IBM BladeCenter HS22V (7871, 1949) IBM BladeCenter HS23 (7875,1929) IBM BladeCenter HS23E (8038, 8039) IBM Flex System x220 Compute Node (7906, 2585) IBM Flex System x240 Compute Node (8737, 8738, 7863) IBM Flex System x440 Compute Node (7917) IBM System x iDataPlex dx360 M4 (7912, 7913) IBM System x3100 M4 (2582) IBM System x3200 M3 (7327, 7328) IBM System x3250 M4 (2583)

第三次作业

ε祈祈猫儿з 提交于 2020-03-21 16:00:49
1. 输入一个年份 , 判断是不是闰年 ( 能被 4 整除但不能被 100 整除 , 或者能被 400 整除 ) package test; import java.util.Scanner; public class wang { public static void main(String[] args) { int year; Scanner sc= new Scanner(System.in); System.out.println("year="); year=sc.nextInt(); if((year%4==0&&year%100!=0)||(year%400==0)){ System.out.println(year+"是闰年"); }else{ System.out.println(year+"是平年"); } } } 2.输入一个4位会员卡号,如果百位数字是3的倍数,就输出是幸运会员,否则就输出不是 package test; import java.util.Scanner; public class wang { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("请输入一个四位数的会员卡号:"); int

wpf(怎么跨线程访问wpf控件)

谁都会走 提交于 2020-03-21 15:32:46
在编写代码时,我们经常会碰到一些子线程中处理完的信息,需要通知另一个线程(我这边处理完了,该你了)。 但是当我们通知WPF的UI线程时需要用到Dispatcher。 首先我们需要想好在UI控件上需要显示什么内容。然后写一个显示UI内容的方法。 以下是代码 private void UIThreaddosomething(string s) //UI线程要做的事情 { //do something //这里也可以做一些其他的事情 Label2.Content = s; ellipse1.Fill=new SolidColorBrush(Colors.Red); ellipse2.Fill=new SolidColorBrush(Colors.Red); } 然后我们声明一个委托,由于UIThreaddosomething有一个字符串参数,所以声明的委托要与其保持一致 public delegate void RefleshUI(string s); 然后在创建一个方法,这个方法将通过委托将子线程与UI线程联系起来。 private void delegatedosomething(string s) { ellipse1.Dispatcher.Invoke(new RefleshUI(UIThreaddosomething), s); // ellipse2.Dispatcher

正则表达式——java实现

て烟熏妆下的殇ゞ 提交于 2020-03-21 10:50:45
——总结自廖雪峰网站 匹配任意字符 “.”可以匹配任意一个字符 String re1 = "a.c"; System.out.println("abc".matches(re1)); System.out.println("a1c".matches(re1)); System.out.println("a*c".matches(re1)); System.out.println("ac".matches(re1)); System.out.println("abbc".matches(re1)); 输出为 true true true false false 来源: https://www.cnblogs.com/lixiaoxu/p/12536758.html

C#插件式开发

∥☆過路亽.° 提交于 2020-03-21 08:24:41
  记录一下C#插件式开发。   原理:主要模块【运行DLL(共享DLL)】、【界面主程序】、【插件DLL】   原理没时间写太详细,以后有机会再补充吧,先上传代码。 以下是C#DLL程序集代码,命名为【Runtime】 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Runtime { public interface IAdd { int Add(int a, int b); } } 以下是C#DLL程序集代码,命名为【Plugin】 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Runtime; namespace Plugin { public class Operation : IAdd { public int Add(int a, int b) { return a + b; } } } 以下是C#Console程序集代码,命名为为【Main】 using Runtime;

SharePoint 2013 引发类型为“System.ArgumentException”的异常。 參数名: encodedValue

纵然是瞬间 提交于 2020-03-21 06:53:34
SharePoint 2013 引发类型为“System.ArgumentException”的异常。 參数名: encodedValue 具体错误信息 说明: 运行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的具体信息。 异常具体信息: System.ArgumentException: 引发类型为“System.ArgumentException”的异常。 參数名: encodedValue 源错误: 运行当前 Web 请求期间生成了未经处理的异常。能够使用以下的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪: [ArgumentException: 引发类型为“System.ArgumentException”的异常。 參数名: encodedValue] Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue) +32372366 Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(IClaimsIdentity

三层架构小示例

天大地大妈咪最大 提交于 2020-03-21 04:23:53
前言:本人由于刚接触不久,所以有许多借鉴的地方,希望大家多多指教。 对于三层架构,大家首先要理解它的机制,具体的在我的博文里面查看,在此不再阐述。还有要有一定的基础,比较重要的就是 类 , 最好先研究下JAVA 。 一、打开VS2008,新建空解决方案,具体如下: 1、文件→新建→项目 2、展开其它项目类型→Visual Studio解决方案→空白解决方案 3、起一个名字,并确定(如下图) 4、在解决方案资源管理器里面右键点击解决方案→添加→新建项目→类库,在名称里输入Model 5、同样的方法,再新建BLL和DAL两个类库 6、在解决方案资源管理器里面右键点击解决方案→添加→新建项目(或者新建网站)→ASP.NET web 应用程序 PS: 小型站点,点“新建网站” ;大一点的,用web应用程序。 新建网站和新建web应用程序,在编译发布之后会有不同的效果: 新建网站在编译发布后,bin目录下,会为每个aspx页面生产一个随机命名的.dll文件,默认情况下,添加的cs文件都会放到App_Code目录管理; 新建web应用程序编译发布会,在bin目录下,只生成当前项目的dll文件. 建好文件目录已经建好了,如下图。 二、数据库的建立与连接 1.在网站里面的APP_DATA文件夹上面点右键,新建一个数据库文件Database.mdf。然后添加一个表user ,表里面一个字段 name