上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 30 下一页
摘要: 结构体类型的字面量由关键字type、类型名称、关键字struct,以及由花括号包裹的若干字段声明组成。 type Person struct { Name string Gender string Age uint8 } Person{Name: "Robert", Gender: "Male", Age: 33} 键值对的顺序与其类型中的... 阅读全文
posted @ 2019-02-19 15:31 osbreak 阅读(324) 评论(0) 推荐(0) 编辑
摘要: 可以把函数作为值来传递和使用。Go语言中的函数可以返回多个结果。 func(input1 string ,input2 string) string 函数接受n个参数func add(a int, arg ...int) int { var sum int = a for i := 0; i < len(arg); i++ { sum += arg[i]... 阅读全文
posted @ 2019-02-19 15:28 osbreak 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 通道类型的表示方法很简单,仅由两部分组成 chan T 在这个类型字面量中,左边是代表通道类型的关键字chan,而右边则是一个可变的部分。 即代表该通道类型允许传递的数据的类型(或称通道的元素类型)。 这两部分之间需要以空格分隔。 与其它的数据类型不同,我们无法表示一个通道类型的值。 因此,我们也无 阅读全文
posted @ 2019-02-18 23:25 osbreak 阅读(284) 评论(0) 推荐(0) 编辑
摘要: 对于数组来说,索引值既不能小于0也不能大于或等于数组值的长度。 索引值的最小有效值从0开始。 len是Go语言的内建函数的名称。 该函数用于获取字符串、数组、切片、字典或通道类型的值的长度。 var length = len(numbers) 如果我们只声明一个数组类型的变量而不为它赋值,那么该变量 阅读全文
posted @ 2019-02-18 22:55 osbreak 阅读(496) 评论(0) 推荐(0) 编辑
摘要: var 声明变量 const 常量的关键字, 常量不能出现只声明不赋值的情况。 名字首字母为大写的程序实体可以被任何代码包中的代码访问到。 名字首字母为小写的程序实体则只能被同一个代码包中的代码所访问。 Go语言的整数类型一共有10个, int, uint byte与rune类型有一个共性,即:它们 阅读全文
posted @ 2019-02-13 22:48 osbreak 阅读(212) 评论(0) 推荐(0) 编辑
摘要: main.go go build main.go 阅读全文
posted @ 2019-02-13 21:24 osbreak 阅读(242) 评论(0) 推荐(0) 编辑
摘要: //加密机制初始化 g_HDMgr.init(); //对方的public key BIGNUM* peerPubKey = NULL; peerPubKey = BN_bin2bn((unsigned char*)pRegist->DH_PubKey, pRegist->nDH_PubKey_Le 阅读全文
posted @ 2019-02-11 16:00 osbreak 阅读(2066) 评论(0) 推荐(0) 编辑
摘要: libevent tcp API整理 1.01 分配并且返回一个新的具有默认设置的 event_base struct event_base *base = event_base_new(); // 运行循环 int event_base_dispatch(struct event_base *ba 阅读全文
posted @ 2019-01-20 14:37 osbreak 阅读(112) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include #include #include #define MAX_LINE 16384 struct fd_state { ... 阅读全文
posted @ 2019-01-17 00:07 osbreak 阅读(180) 评论(0) 推荐(0) 编辑
摘要: LibEvent 实现的低级 ROT13 例子 #include #include #include #include #include #include #include #include #include #include #include #define MAX_LINE 16384 struct fd_st... 阅读全文
posted @ 2019-01-16 23:24 osbreak 阅读(291) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 30 下一页