The Inbox: Network-fbs.108.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Network-fbs.108.mcz

commits-2
A new version of Network was added to project The Inbox:
http://source.squeak.org/inbox/Network-fbs.108.mcz

==================== Summary ====================

Name: Network-fbs.108
Author: fbs
Time: 18 February 2011, 11:00:05.486 am
UUID: 228bf8a5-3dd5-be4f-a34b-2223842e5bab
Ancestors: Network-nice.107

Provide a (TCP) data send with explicit timeout. The existing method (Socket>>sendSomeData:startIndex:count:) calls the new method with a default timeout of 20s.

=============== Diff against Network-nice.107 ===============

Item was changed:
  ----- Method: Socket>>sendSomeData:startIndex:count: (in category 'sending') -----
  sendSomeData: aStringOrByteArray startIndex: startIndex count: count
+ ^ self sendSomeData: aStringOrByteArray startIndex: startIndex count: count for: 20.!
- "Send up to count bytes of the given data starting at the given index. Answer the number of bytes actually sent."
- "Note: This operation may have to be repeated multiple times to send a large amount of data."
-
- | bytesSent |
- (self waitForSendDoneFor: 20)
- ifTrue: [
- bytesSent := self primSocket: socketHandle
- sendData: aStringOrByteArray
- startIndex: startIndex
- count: count]
- ifFalse: [ConnectionTimedOut signal: 'send data timeout; data not sent'].
- ^ bytesSent
- !

Item was added:
+ ----- Method: Socket>>sendSomeData:startIndex:count:for: (in category 'sending') -----
+ sendSomeData: aStringOrByteArray startIndex: startIndex count: count for: aTimeoutInSeconds
+ "Send up to count bytes of the given data starting at the given index. Answer the number of bytes actually sent."
+ "Note: This operation may have to be repeated multiple times to send a large amount of data."
+
+ | bytesSent |
+ (self waitForSendDoneFor: aTimeoutInSeconds)
+ ifTrue: [
+ bytesSent := self primSocket: socketHandle
+ sendData: aStringOrByteArray
+ startIndex: startIndex
+ count: count]
+ ifFalse: [ConnectionTimedOut signal: 'send data timeout; data not sent'].
+ ^ bytesSent
+ !