| | |
| | | "github.com/gogo/protobuf/proto" |
| | | "github.com/satori/go.uuid" |
| | | "io/ioutil" |
| | | "time" |
| | | ) |
| | | |
| | | const ( |
| | |
| | | InitService() |
| | | imgData := readImgFile() |
| | | fmt.Println("imgData.len:",len(imgData)) |
| | | for { |
| | | //for { |
| | | PushImgMsg(protomsg.Recvmsg{ |
| | | Id:uuid.NewV4().String(), |
| | | Addr:"", |
| | | Picdata:imgData, |
| | | }) |
| | | fmt.Println("pushed img") |
| | | time.Sleep(5*time.Second) |
| | | } |
| | | //time.Sleep(5*time.Second) |
| | | //} |
| | | } |
| | | |
| | | func readImgFile() []byte{ |
| | |
| | | case is := <- imgPushChan: |
| | | fmt.Println("imgPushChan in") |
| | | b, _ := proto.Marshal(&is) |
| | | client_push.Send(b) |
| | | err := client_push.Send(b) |
| | | if err !=nil { |
| | | fmt.Println("img Send err:",err) |
| | | } |
| | | default: |
| | | //fmt.Println("no img in") |
| | | } |