nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib/socket: Socket now subclass of BufferedIStream and OStream
[nit.git]
/
examples
/
socket_server.nit
diff --git
a/examples/socket_server.nit
b/examples/socket_server.nit
index
9df9d79
..
8754ce2
100644
(file)
--- a/
examples/socket_server.nit
+++ b/
examples/socket_server.nit
@@
-26,8
+26,6
@@
end
var socket = new Socket.stream_with_port(args[0].to_i)
print "[PORT] : {socket.port.to_s}"
var socket = new Socket.stream_with_port(args[0].to_i)
print "[PORT] : {socket.port.to_s}"
-print "Binding ... {socket.bind.to_s}"
-print "Listening ... {socket.listen(3).to_s}"
var clients = new Array[Socket]
var max = socket
var clients = new Array[Socket]
var max = socket
@@
-45,9
+43,10
@@
loop
if fs.readset.is_set(socket) then
var ns = socket.accept
print "Accepting {ns.address} ... "
if fs.readset.is_set(socket) then
var ns = socket.accept
print "Accepting {ns.address} ... "
- print "[Message from {ns.address}] : {ns.read}"
+ print "[Message from {ns.address}] : {ns.read(100)}"
ns.write("Goodbye client.")
ns.write("Goodbye client.")
- print "Closing {ns.address} ... {ns.close.to_s}"
+ print "Closing {ns.address} ..."
+ ns.close
end
end
end
end