Sockets: Difference between revisions
Content added Content deleted
(omitting from Yorick) |
|||
Line 362: | Line 362: | ||
}</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|Lua}}== |
|||
Requires: LuaSocket |
|||
<lang lua>socket = require "socket" |
|||
host, port = "127.0.0.1", 256 |
|||
sid = socket.udp() |
|||
sid:sendto( "hello socket world", host, port ) |
|||
sid:close()</lang> |
|||
=={{header|Objeck}}== |
=={{header|Objeck}}== |