Sockets: Difference between revisions

Content added Content deleted
m ({{omit from|GUISS}})
(Fix UNIX Shell to run 'nc', not 'netcat'. (Some systems only have 'nc'.) Delete redundant UnixPipes example.)
Line 677: Line 677:
#! The actual server
#! The actual server
[ " hello socket world" server.send ] 256 server.start</lang>
[ " hello socket world" server.send ] 256 server.start</lang>

=={{header|UnixPipes}}==
<lang bash>(echo "hello socket world" | nc localhost 256 | exit 0)</lang>


=={{header|UNIX Shell}}==
=={{header|UNIX Shell}}==
Using netcat:

{{libheader|nc}}
<lang bash>echo "hello socket world" | nc localhost 256</lang>


When the connection fails, <code>nc</code> exits 1. To see an error message, use <code>nc -v localhost 256</code>.
Using the program <tt>netcat</tt> (<tt>nc</tt>)


<lang bash>echo "hello socket world" | netcat localhost 256</lang>
=={{header|Visual Basic .NET}}==
=={{header|Visual Basic .NET}}==