Sockets: Difference between revisions

377 bytes added ,  10 years ago
(Added zkl)
Line 677:
sock.write("hello socket world")
sock.close</lang>
 
=={{header|Scala}}==
[[Category:Scala Implementations]]{{libheader|Scala}}<lang Scala>import java.net.Socket
 
object sendSocketData {
 
def sendData(host: String, msg: String) {
val sock = new Socket(host, 256)
sock.getOutputStream().write(msg.getBytes())
sock.getOutputStream().flush()
sock.close()
}
 
sendData("localhost", "hello socket world")
}</lang>
 
=={{header|Scheme}}==
{{works with|Guile|1.8.8}}{{works with|Chicken Scheme|4.6.0}}
{{works with|Chicken Scheme|4.6.0}}
<lang scheme>(let ((s (socket PF_INET SOCK_STREAM 0)))
(connect s AF_INET (inet-pton AF_INET "127.0.0.1") 256)
Anonymous user