上一页 1 2 3 4 5 6 7 8 9 10 ··· 21 下一页
摘要: 特别注意: 嵌套模板使用 非常重要 结构 前台代码: <!DOCTYPE html> <html> <head> <title>user</title> </head> <script type="text/javascript"> </script> <body> /* range 循环的使用 * 阅读全文
posted @ 2020-07-24 17:24 酒沉吟 阅读(937) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-07-23 18:18 酒沉吟 阅读(0) 评论(0) 推荐(0) 编辑
摘要: 服务器端文件结构主要是 proto 文件夹(主要是.proto文件),service文件夹,mian.go文件 定义GRPC ptoto文件 注意: 1. 头 syntax="proto3"; 必要 2. 包package的定义 3. service 的定义 4. rpc方法的定义 5.messag 阅读全文
posted @ 2020-07-23 18:10 酒沉吟 阅读(265) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-07-21 18:54 酒沉吟 阅读(0) 评论(0) 推荐(0) 编辑
摘要: 收发消息实体 package model // 发送或者接收的消息信息 type SmsMessage struct { // 消息 类型 1 注册 2登陆 3在线状态 4私聊信息 5群发信息 6下线线状态 7 服务端返回信息 8 服务端返回客户端发送失败或错误信息 Type int32 `json 阅读全文
posted @ 2020-07-19 17:45 酒沉吟 阅读(405) 评论(0) 推荐(0) 编辑
摘要: go mod init go get github.com/go-redis/redis package main import ( "encoding/json" "fmt" "github.com/go-redis/redis" "time" ) // 定时任务Task 执行代码 func in 阅读全文
posted @ 2020-07-16 18:33 酒沉吟 阅读(209) 评论(0) 推荐(0) 编辑
摘要: Go版本在1.11之后推出了go module模式来管理依赖(还有go get、vendor这两种方式),使用go mod时下载的依赖文件在$GOPATH/pkg/mod/下。本文以两种办法介绍如何创建go mod项目。 go mod是时候用起来了! 目录 第1种:假如你一开始就用goland开启旅 阅读全文
posted @ 2020-07-16 17:39 酒沉吟 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 1.服务端监听并处理接收信息 package main import ( "fmt" "io" "net" ) func process(conn net.Conn){ defer conn.Close() for { fmt.Println("服务器的等 待客户端写入……") readByte : 阅读全文
posted @ 2020-07-16 16:30 酒沉吟 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 1.1~8000查找素数的例子 package main import "fmt" // 向intChan放入1-8000个数 func putNum(intChan chan int){ for i:=1;i<=80000;i++{ intChan<-i } // 关闭intChan close( 阅读全文
posted @ 2020-07-15 17:17 酒沉吟 阅读(338) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-07-13 18:20 酒沉吟 阅读(237) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 21 下一页