'From Squeakland 3.8-05 of 7 September 2005 [latest update: #530] on 31 January 2006 at 5:53:35 pm'! ObjectSocket subclass: #StringSocket instanceVariableNames: 'numStringsInNextArray stringsForNextArray nextStringSize files startTime stringCounter socketWriterProcess outputQueue bytesInOutputQueue extraUnsentBytes transmissionError readBuffer ' classVariableNames: 'MaxRatesSeen RecentSendHistory RunningSendCount ' poolDictionaries: '' category: 'Nebraska-Network-ObjectSocket'! !Socket methodsFor: 'receiving' stamp: 'yo 10/10/2005 18:47'! receiveAvailableDataIntoBuffer: buffer "Receive all available data (if any). Do not wait." | bytesRead | bytesRead _ self receiveAvailableDataInto: buffer. ^buffer copyFrom: 1 to: bytesRead! ! !StringSocket methodsFor: 'private-IO' stamp: 'yo 10/10/2005 18:49'! addToInBuf: aString | newAlloc | newAlloc _ aString size * 2 max: 80000. inBuf ifNil: [ inBuf _ String new: newAlloc. inBufIndex _ 1. inBufLastIndex _ 0. ]. aString size > (inBuf size - inBufLastIndex) ifTrue: [ inBuf _ inBuf , (String new: newAlloc) ]. inBuf replaceFrom: inBufLastIndex + 1 to: inBufLastIndex + aString size with: aString startingAt: 1. inBufLastIndex _ inBufLastIndex + aString size. ! ! !StringSocket methodsFor: 'private-IO' stamp: 'yo 10/10/2005 18:47'! processInput | totalReceived chunkOfData | "do as much input as possible" self flag: #XXX. "should have resource limits here--no more than X objects and Y bytes" chunkOfData _ socket receiveAvailableDataIntoBuffer: self readBuffer. self addToInBuf: chunkOfData. totalReceived _ chunkOfData size. totalReceived > 0 ifTrue: [ NebraskaDebug at: #SendReceiveStats add: {'GET'. totalReceived}. ]. [ self gotSomething ] whileTrue: []. "decode as many string arrays as possible" self shrinkInBuf.! ! !StringSocket methodsFor: 'as yet unclassified' stamp: 'yo 10/10/2005 18:47'! readBuffer ^ readBuffer ifNil: [readBuffer _ String new: 20000]. ! ! ObjectSocket subclass: #StringSocket instanceVariableNames: 'numStringsInNextArray stringsForNextArray nextStringSize files startTime stringCounter socketWriterProcess outputQueue bytesInOutputQueue extraUnsentBytes transmissionError readBuffer' classVariableNames: 'MaxRatesSeen RecentSendHistory RunningSendCount' poolDictionaries: '' category: 'Nebraska-Network-ObjectSocket'!