Sockets: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl}}: another obvious one)
(added J)
Line 279: Line 279:


If there is no listener on this port, this will hang for a while before timing out.
If there is no listener on this port, this will hang for a while before timing out.

=={{header|J}}==
The <code>sdcheck</code>s raise assertions if anything goes wrong:

<lang j> coinsert'jsocket' [ require 'socket' NB. Sockets library
socket =. >{.sdcheck sdsocket'' NB. Open a socket
host =. sdcheck sdgethostbyname 'localhost' NB. Resolve host
sdcheck sdconnect socket ; host ,< 256 NB. Create connection to port 256
sdcheck 'hello socket world' sdsend socket , 0 NB. Send msg</lang>


=={{header|Java}}==
=={{header|Java}}==