Sockets: Difference between revisions

Content added Content deleted
(added racket)
(added Julia implementation of Sockets)
Line 453: Line 453:
}</lang>
}</lang>
Encapsulating the <code>Socket</code>'s <code>OutputStream</code> in a <code>PrintStream</code> (for data) or <code>PrintWriter</code> (for text) may be easier in more complex programs for their auto-flush abilities, encoding management, and their overloaded <code>print</code> and <code>println</code> methods. The <code>write</code> method from the original <code>OutputStream</code> will still be available.
Encapsulating the <code>Socket</code>'s <code>OutputStream</code> in a <code>PrintStream</code> (for data) or <code>PrintWriter</code> (for text) may be easier in more complex programs for their auto-flush abilities, encoding management, and their overloaded <code>print</code> and <code>println</code> methods. The <code>write</code> method from the original <code>OutputStream</code> will still be available.

=={{header|Julia}}==
<lang Julia>
socket = connect("localhost",256)
write(socket, "hello socket world")
close(socket)
</lang>

=={{header|Lua}}==
=={{header|Lua}}==
Requires: LuaSocket
Requires: LuaSocket