emacs-erc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UNIX domain sockets


From: J.P.
Subject: Re: UNIX domain sockets
Date: Thu, 19 Aug 2021 05:54:00 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

"J.P." <jp@neverwas.me> writes:

> You can forward normal sockets over SSH, so they must be doing something
> special.

The same person (I think) was asking about this again. Hopefully this
baseline repro will help clear things up. It requires an sshd instance
and the ncat program.

1. Open a terminal and run:

  $ ssh -TNL /tmp/my.sock:localhost:6667 localhost

2. Save this /tmp/somewhere and make it executable:

  #!/bin/sh

  printf '%s\r\n' \
         ':gnu.org 001 tester :Welcome tester' \
         ':gnu.org 004 tester gnu.org ncat B C' \
         ':gnu.org 005 tester NETWORK=Gnu NICKLEN=9 PREFIX=(ov)@+ :haz \
         ':gnu.org 422 tester :MOTD missing'

  while read -r line; do
      case "$line" in
          PING*)
              printf '%s\n' "PONG $(printf %s "$line" | cut -d" " -f2)"
              ;;
          QUIT*)
              break
              ;;
      esac
  done

3. In another terminal:

  $ ncat --exec /tmp/somewhere -l 6667

4. In an emacs -Q session, eval:

  (require 'erc)

  (let ((erc-server-connect-function
         (lambda (n b _ p &rest r)
           (apply #'make-network-process
                  `(:name ,n :buffer ,b :service ,p :family local ,@r)))))
    (erc :port "/tmp/my.sock" :nick "tester"))

It should connect and idle forever.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]