sanford-protocol 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -3
- data/lib/sanford-protocol/connection.rb +14 -2
- data/lib/sanford-protocol/version.rb +1 -1
- data/sanford-protocol.gemspec +1 -1
- metadata +7 -7
data/Rakefile
CHANGED
@@ -63,7 +63,7 @@ module Sanford::Protocol
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def read(number_of_bytes)
|
66
|
-
|
66
|
+
recv(number_of_bytes)
|
67
67
|
end
|
68
68
|
|
69
69
|
def write(*binary_strings)
|
@@ -71,12 +71,24 @@ module Sanford::Protocol
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def peek(number_of_bytes = 1)
|
74
|
-
|
74
|
+
recv(number_of_bytes, ::Socket::MSG_PEEK)
|
75
75
|
end
|
76
76
|
|
77
77
|
def close
|
78
78
|
tcp_socket.close rescue false
|
79
79
|
end
|
80
|
+
|
81
|
+
protected
|
82
|
+
|
83
|
+
def recv(number_of_bytes, *flags)
|
84
|
+
value = ""
|
85
|
+
while value.bytesize < number_of_bytes
|
86
|
+
data = tcp_socket.recv(number_of_bytes - value.bytesize, *flags)
|
87
|
+
!data.empty? ? value += data : break
|
88
|
+
end
|
89
|
+
value
|
90
|
+
end
|
91
|
+
|
80
92
|
end
|
81
93
|
|
82
94
|
class TimeoutError < RuntimeError
|
data/sanford-protocol.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sanford-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 4
|
10
|
+
version: 0.5.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Collin Redding
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2013-
|
19
|
+
date: 2013-03-04 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
prerelease: false
|
@@ -40,11 +40,11 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
hash:
|
43
|
+
hash: 3
|
44
44
|
segments:
|
45
|
-
-
|
45
|
+
- 2
|
46
46
|
- 0
|
47
|
-
version: "
|
47
|
+
version: "2.0"
|
48
48
|
requirement: *id002
|
49
49
|
name: assert
|
50
50
|
type: :development
|