socket man page on DragonFly

Printed from http://www.polarhome.com/service/man/?qf=socket&af=0&tf=2&of=DragonFly

SOCKET(1)							     SOCKET(1)

NAME
       socket - create tcp socket and connect to stdin/out

SYNOPSIS
       socket [ -bcfqrvw ] [ -p command ] host port
       socket [ -bcfqrvw ] [ -p command ] -s [ -l ] port

DESCRIPTION
       Socket  creates	an Internet domain TCP socket and connects it to stdin
       and stdout.  The host argument can be an Internet number	 in  dot-nota‐
       tion (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  gethost‐
       byname(3).   The	 port  argument can be a port number or a service name
       which can be mapped to a port number by getservbyname(3).

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.

       -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 stan‐
	      dard  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.

       -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 out‐
	      put.

       -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 con‐
       dition at the standard output of the program  occurs.  Then a new  con‐
       nection 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.

SEE ALSO
       accept(2), bind(2), connect(2), socket(2), gethostbyname(3), getservby‐
       name(3)

BUGS
       socket -p terminates due to a SIGPIPE signal when there	is  more  data
       from the socket available than the executed program wants to read.

       Please report any other bugs to the author.

VERSION
       This manual page describes Socket-1.1.

AUTHOR
       Juergen Nickelsen <jn@berlin.snafu.de>

				 Aug  6, 1992			     SOCKET(1)
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net