Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/msgPublic

Package msg provides a way to use System V message queues.

License

NotificationsYou must be signed in to change notification settings

hslam/msg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PkgGoDevBuild StatusGo Report CardLICENSE

Package msg provides a way to use System V message queues.

Get started

Install

go get github.com/hslam/msg

Import

import "github.com/hslam/msg"

Usage

Example

msgsnd

package mainimport ("github.com/hslam/ftok""github.com/hslam/msg""time")funcmain() {key,err:=ftok.Ftok("/tmp",0x22)iferr!=nil {panic(err)}msgid,err:=msg.Get(key,msg.IPC_CREAT|0600)iferr!=nil {panic(err)}defermsg.Remove(msgid)err=msg.Send(msgid,1, []byte("Hello World"),0600)iferr!=nil {panic(err)}time.Sleep(time.Second*10)}

msgrcv

package mainimport ("fmt""github.com/hslam/ftok""github.com/hslam/msg")funcmain() {key,err:=ftok.Ftok("/tmp",0x22)iferr!=nil {panic(err)}msgid,err:=msg.Get(key,0600)iferr!=nil {panic(err)}text,err:=msg.Receive(msgid,1,0600)iferr!=nil {panic(err)}fmt.Println(string(text))}

Output

Hello World

License

This package is licensed under a MIT license (Copyright (c) 2020 Meng Huang)

Author

msg was written by Meng Huang.

About

Package msg provides a way to use System V message queues.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp