diff -r 7c2c8f7233bd -r f3acd5382fa1 Socket.st --- a/Socket.st Fri Feb 03 12:19:41 2006 +0100 +++ b/Socket.st Wed Feb 15 14:52:13 2006 +0100 @@ -1015,6 +1015,16 @@ ^ #stream ! ! +!Socket class methodsFor:'Compatibility-Squeak'! + +initializeNetwork + "/ intentionally left blank here +! + +wildcardPort + ^ nil +! ! + !Socket class methodsFor:'Compatibility-VW'! AF_INET @@ -1567,6 +1577,42 @@ ^ self getPeer ! +primSocketLocalPort:aSocket + ^ port +! + +sendData: aStringOrByteArray + "Send all of the data in the given array, even if it requires multiple calls to send it all. + Return the number of bytes sent." + + "An experimental version use on slow lines: Longer timeout and smaller writes to try to avoid spurious timeouts." + + |remaining nWritten| + +Transcript show:'>> '; showCR:aStringOrByteArray. + + remaining := aStringOrByteArray size. + [remaining > 0] whileTrue:[ + nWritten := self nextPutBytes:remaining from:aStringOrByteArray startingAt:1. + remaining := remaining - nWritten. + ]. + ^ aStringOrByteArray size. + +"/ | bytesSent bytesToSend count | +"/ bytesToSend := aStringOrByteArray size. +"/ bytesSent := 0. +"/ [bytesSent < bytesToSend] whileTrue: [ +"/ (self waitForSendDoneFor: 60) +"/ ifFalse: [ConnectionTimedOut signal: 'send data timeout; data not sent']. +"/ count := self primSocket: socketHandle +"/ sendData: aStringOrByteArray +"/ startIndex: bytesSent + 1 +"/ count: (bytesToSend - bytesSent min: 5000). +"/ bytesSent := bytesSent + count]. +"/ +"/ ^ bytesSent +! + setOption: optionName value: optionValue optionName = 'TCP_NODELAY' ifTrue:[ ^ self setTCPNoDelay:optionValue @@ -1574,6 +1620,10 @@ self error:'unimplemented socketoption' mayProceed:true ! +socketHandle + ^ self +! + waitForConnectionUntil:aMillisecondClockValue self shouldImplement. ! ! @@ -4034,5 +4084,5 @@ !Socket class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.224 2006-01-11 15:45:05 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.225 2006-02-15 13:52:13 cg Exp $' ! !