From: Tom Anderson on
Evening all,

I'd like to have a shell script which accepted connections over the
network and responded to messages sent over sockets. I can do this with
good old inetd, but i was wondering if there were other ways to do it. Is
there a way to do socket/bind/listen/accept directly from bash? Or any
other construct (unix domain socket trickery etc) that would let a script
work with sockets accepted on its behalf by some binary process?

tom

--
1 pWN 3v3Ry+h1n G!!!1
From: Robert Billing on
As the bottle floated ashore we opened it and found the message that Tom
Anderson had written:

> Evening all,
>
> I'd like to have a shell script which accepted connections over the
> network and responded to messages sent over sockets. I can do this with
> good old inetd, but i was wondering if there were other ways to do it.
> Is there a way to do socket/bind/listen/accept directly from bash? Or
> any other construct (unix domain socket trickery etc) that would let a
> script work with sockets accepted on its behalf by some binary process?

It might be easier to do this from Perl or TCL than from bash.




--
I am Robert Billing, Christian, author, inventor, traveller, cook and
animal lover. "It burned me from within. It quickened; I was with book
as a woman is with child."
Quality e-books for portable readers: http://www.alex-library.com
From: Martin Gregorie on
On Thu, 18 Mar 2010 22:09:02 +0000, Tom Anderson wrote:

> Evening all,
>
> I'd like to have a shell script which accepted connections over the
> network and responded to messages sent over sockets. I can do this with
> good old inetd, but i was wondering if there were other ways to do it.
> Is there a way to do socket/bind/listen/accept directly from bash? Or
> any other construct (unix domain socket trickery etc) that would let a
> script work with sockets accepted on its behalf by some binary process?
>
> tom

Have you looked at nc / netcat?

However, I'd go with xinetd for the sheer simplicity of doing it that way.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
From: Mark Hobley on
Tom Anderson <twic(a)urchin.earth.li> wrote:
> Is there a way to do socket/bind/listen/accept directly from bash?

Yeah. The bash shell supports socket programming via the /dev/tcp interface.
I was looking to implement /dev/tcp as a general system device (rather than
as a bashism).

Mark.

--
Mark Hobley
Linux User: #370818 http://markhobley.yi.org/

From: Tom Anderson on
On Fri, 19 Mar 2010, Mark Hobley wrote:

> Tom Anderson <twic(a)urchin.earth.li> wrote:
>> Is there a way to do socket/bind/listen/accept directly from bash?
>
> Yeah. The bash shell supports socket programming via the /dev/tcp
> interface. I was looking to implement /dev/tcp as a general system
> device (rather than as a bashism).

Eeeeenteresting. Can you do listening (server-side) sockets with /dev/tcp?
All the descriptions i can find are about client-side sockets.

tom

--
The cause? Thatcher again. Not for any specific reasons but she's always
the root of every problem in Britain today. -- Mike