1

I need to run a socket on CentOS as we have socket installed on Ubuntu. Is there any similar way I can do it on CentOS?

NOTE: I can run simply socket on Ubuntu by socket -sl 555 -B 0.0.0.0.

1 Answer 1

0

Background

Based on your question, I'm going to assume you mean you have this package, socket on your Ubuntu boxes:

$ sudo apt-cache show socket
Package: socket
Priority: optional
Section: universe/net
Installed-Size: 76
Maintainer: Ubuntu MOTU Developers <[email protected]>
Original-Maintainer: LENART Janos <[email protected]>
Architecture: amd64
Version: 1.1-10
Depends: libc6 (>= 2.4)
Filename: pool/universe/s/socket/socket_1.1-10_amd64.deb
Size: 16846
MD5sum: b258cb002cd0bf83ef7cd81ea8ebc203
SHA1: 45964483ba4c7b29ac90ec6ddd57b87bb2c8f507
SHA256: 9b3496c61a5d81241ab83c7541de456a4e0f8d2ade3eaa122e6f64ab28e81c2b
Description-en: Multi purpose socket tool
 The socket program is a simple tool for socket based connections. It
 can be used to create simple daemons (in both standalone and inetd
 mode), to connect to other daemons or to redirect ports.
Description-md5: 286dc3011950982c9923a6a69c875ca9
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

I don't see this package available in any CentOS YUM repository and from the looks of it, it's quite dated. Appears to not have been updated since 2009:

2009-04-14 - LENART Janos socket (1.1-10) unstable; urgency=low * (Re-) Adopting the package. (closes: #487341) * Applied excellent patch from Andras Pal + Fixed some missing headers + (hopefully) complete support for UNIX domain sockets

Alternatives

Given all this I'd be inclined to use nc (netcat) or socat. There's several recipes that show how to do things using socat.

Something similar to what you're showing with this command:

$ socket -sl 555 -B 0.0.0.0

Can be achieved with nc, for example:

$ nc -4 -l -p 555 -k

Or with socat:

$ socat - tcp-l:555,ignoreeof
2
  • awesome. If you could explain a bit about ignoreeof Jul 6, 2018 at 6:10
  • ignoreeof, tells the connection to stay up, even after a client disconnects from it.
    – slm
    Jul 6, 2018 at 6:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .