⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (482 Bytes)
Bug #9753
» simple_server2.rb
ThomasWLynch (Thomas Lynch)
, 04/17/2014 10:23 AM
#!/bin/ruby
=begin
a simple server
=end
require
'socket'
server
=
UNIXServer
.
new
(
"test_socket"
)
session_id
=
0
while
(
data_sock
=
server
.
accept
)
Thread
.
new
(
session_id
)
{
|
our_session
|
puts
"server starting session
#{
our_session
}
"
while
(
request
=
data_sock
.
gets
)
puts
request
data_sock
.
puts
"{
\"
reply
\"
:
\"
test_interface_to_interface
\"
}"
end
puts
"client closed the connection
#{
our_session
}
"
}
session_id
+=
1
end
server
.
close
« Previous
1
2
3
…
5
Next »
(1-1/5)
Loading...