return
end
-var s = new Socket.stream_with_host(args[0], args[1].to_i)
+var s = new Socket.client(args[0], args[1].to_i)
print "[HOST ADDRESS] : {s.address}"
print "[HOST] : {s.host}"
print "[PORT] : {s.port}"
return
end
-var socket = new Socket.stream_with_port(args[0].to_i)
+var socket = new Socket.server(args[0].to_i, 1)
print "[PORT] : {socket.port.to_s}"
var clients = new Array[Socket]
do
var p: nullable Socket = null
- p = new Socket.stream_with_host(host, port)
- p.connect
+ p = new Socket.client(host, port)
sys.nanosleep(0,5000)
redef var end_reached = false
# Creates a socket connection to host `thost` on port `port`
- init stream_with_host(thost: String, tport: Int)
+ init client(thost: String, tport: Int)
do
_buffer = new FlatBuffer
_buffer_pos = 0
if not end_reached then end_reached = not connect
end
- # Creates a server socket on port `tport`
- init stream_with_port(tport: Int)
+ # Creates a server socket on port `tport`, with a connection queue of size `max`
+ init server(tport: Int, max: Int)
do
_buffer = new FlatBuffer
_buffer_pos = 0