Giter Site home page Giter Site logo

go-unix-domain-socket-example's Introduction

go-unix-domain-socket-example

Unix domain socket (UDS) example by golang

How to Run

Using go-task

$ task --list
* run-basic:            run basic example
* run-readwrite:        run readwrite example
* run-readwrite2:       run readwrite2 example
* run-usinggob:         run usinggob example

$ task [run-basic|run-readwrite|run-readwrite2|run-usinggob]

basic

Open two terminals. the one is following:

$ cd cmd/basic/server
$ go run .

and another terminal is following:

$ cd cmd/basic/client
$ go run .

read & write per connection

Open two terminals. the one is following:

$ cd cmd/readwrite/server
$ go run .

and another terminal is following:

$ cd cmd/readwrite/client
$ go run .

N read & write on one connection

Open two terminals. the one is following:

$ cd cmd/readwrite2/server
$ go run .

and another terminal is following:

$ cd cmd/readwrite2/client
$ go run .

Using encoding/gob package

Open two terminals. the one is following:

$ cd cmd/usinggob/server
$ go run .

and another terminal is following:

$ cd cmd/usinggob/client
$ go run .

Monitor a local unix domain socket

use socat. install it if not exists.

$ sudo apt install -y socat

and launch server program then input following commands.

$ mv /tmp/echo.sock /tmp/echo.sock.original
$ socat -t100 -x -v UNIX-LISTEN:/tmp/echo.sock,mode=777,reuseaddr,fork UNIX-CONNECT:/tmp/echo.sock.original

REFERENCES

Can I monitor a local unix domain socket like tcpdump?

go-unix-domain-socket-example's People

Contributors

devlights avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

go-unix-domain-socket-example's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.