Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/Sockets/NetRexx/sockets.netrexx
Normal file
28
Task/Sockets/NetRexx/sockets.netrexx
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols nobinary
|
||||
import java.net.
|
||||
|
||||
runSample(arg)
|
||||
return
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
method runSample(arg) private static
|
||||
parse arg host':'port':'message
|
||||
if host = '' then host = 'localhost'
|
||||
if port = '' then port = 256
|
||||
if message = '' then message = 'hello socket world'
|
||||
sendToSocket(host, port, message)
|
||||
return
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
method sendToSocket(host, port, message) public static
|
||||
do
|
||||
sokt = Socket(host, port)
|
||||
soks = sokt.getOutputStream()
|
||||
soks.write((String message).getBytes())
|
||||
soks.flush()
|
||||
sokt.close()
|
||||
catch ix = IOException
|
||||
ix.printStackTrace()
|
||||
end
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue