EnglishFrenchSpanish

OnWorks favicon

socket - Online in the Cloud

Run socket in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command socket that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


socket - create a TCP or a UNIX domain socket and connect to stdin/out

SYNOPSIS


socket [ -bcfqrvw ] [ -p command ] [ -B local address ] host port
socket [ -bcfqrvw ] [ -p command ] /path
socket [ -bcfqrvw ] [ -p command ] [ -B local address ] -s [ -l ] port
socket [ -bcfqrvw ] [ -p command ] -s [ -l ] /path

DESCRIPTION


Socket creates an Internet domain TCP or a UNIX domain stream socket and connects it to
stdin and stdout. The host argument can be an Internet number in dot-notation (like
``130.149.28.10'') or a domain name. In this case it must be possible to resolve the name
to a valid Internet address with gethostbyname(3). The port argument can be a port number
or a service name which can be mapped to a port number by getservbyname(3). If an UNIX
domain socket is wanted to be created instead of an Internet socket, specify the path
instead of an internet (canonical domain named or dot-notated) host. The hostname is
treated as a pathname if contains at least a single slash. I.e. if one wants to create or
connect to a socket in the current directory, use ./filename to specify the connection
point.

OPTIONS


-b (background)
The program forks itself into the background, detaches from its controlling tty,
closes the file descriptors associated with the tty, and changes its current
directory to the root directory.

-B (local address)
This option specifies which local address to binded to when making a connection.

-c (crlf)
Linefeed characters (LF) are converted to a Carriage Return Linefeed sequence
(CRLF) when written to the socket. CRLF sequences read from the socket are
converted to a single LF.

-f (fork)
When a server connection has been accepted, a separate process is forked to handle
the connection in background.

-l (loop)
(only valid with -s) After a connection has been closed, another connection is
accepted.

-p (program)
The specified command is executed for each connection. Its standard input, standard
output, and standard error channels are connected to the socket. Command can be
any shell command since it is passed to /bin/sh.

-q (quit)
The connection is closed when an end-of-file condition occurs on standard input.

-r (read only)
No data is read from standard input and written to the socket.

-s (server)
A server socket is created. A hostname argument is not required of Internet
sockets, only the port number but a pathname is required for UNIX domain sockets.

-v (verbose)
Messages about connections etc. are issued to stderr.

-w (write only)
No data is read from the socket and written to the standard output.

-version
Socket prints its version ID and terminates. This must be the first argument to
have an effect.

EXAMPLES


The command

socket -v coma.cs.tu-berlin.de nntp

connects to the nntp port (port 119) of coma.cs.tu-berlin.de (130.149.28.10).
The command

socket -sl 3425

creates a server socket on port 3425 on the local host and waits for a connection. After
a connection has been closed, a new connection is accepted.
The command

socket -wslqvp "echo Socket! " 1938

creates a server socket on port 1938 on the local host and waits for a connection. When a
connection is accepted, the string "Socket!" is written to the socket. No data is read
from the socket and written to the finger program. The connection is closed when an end-
of-file condition at the standard output of the program occurs. Then a new connection is
accepted.

DIAGNOSTICS


Lots of diagnostics for failed system calls.

unknown host host
host's address could not be resolved.

Signal signal caught, exiting
Socket exits on any signal other than SIGTSTP, SIGCONT, SIGCLD, SIGQUIT.

A non-zero exit code is returned if socket terminates due to an error condition or a
signal.

Use socket online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Phaser
    Phaser
    Phaser is a fast, free, and fun open
    source HTML5 game framework that offers
    WebGL and Canvas rendering across
    desktop and mobile web browsers. Games
    can be co...
    Download Phaser
  • 2
    VASSAL Engine
    VASSAL Engine
    VASSAL is a game engine for creating
    electronic versions of traditional board
    and card games. It provides support for
    game piece rendering and interaction,
    and...
    Download VASSAL Engine
  • 3
    OpenPDF - Fork of iText
    OpenPDF - Fork of iText
    OpenPDF is a Java library for creating
    and editing PDF files with a LGPL and
    MPL open source license. OpenPDF is the
    LGPL/MPL open source successor of iText,
    a...
    Download OpenPDF - Fork of iText
  • 4
    SAGA GIS
    SAGA GIS
    SAGA - System for Automated
    Geoscientific Analyses - is a Geographic
    Information System (GIS) software with
    immense capabilities for geodata
    processing and ana...
    Download SAGA GIS
  • 5
    Toolbox for Java/JTOpen
    Toolbox for Java/JTOpen
    The IBM Toolbox for Java / JTOpen is a
    library of Java classes supporting the
    client/server and internet programming
    models to a system running OS/400,
    i5/OS, o...
    Download Toolbox for Java/JTOpen
  • 6
    D3.js
    D3.js
    D3.js (or D3 for Data-Driven Documents)
    is a JavaScript library that allows you
    to produce dynamic, interactive data
    visualizations in web browsers. With D3
    you...
    Download D3.js
  • More »

Linux commands

Ad