Guidance on use of Socket

John M McIntosh johnmci at smalltalkconsulting.com
Fri Dec 28 19:06:23 UTC 2007


On Dec 28, 2007, at 10:44 AM, Janko Mivšek wrote:

> And I managed to make a mistake or two in below code. But you'll  
> probably find it by yourself :)



Well and a few other hints...

(a) when someone sends you say 10 bytes of data, when those 10 bytes  
of data will arrive occurs
sometime between now and the future. A classic mistake is doing a read  
and thinking you've gotten
all the data... However you might find that last byte (well frame  
actually) is wandering about in some router still...

(b) when you send data, then close the socket before checking to see  
if all the data is sent, the logic if it's
set to Socket Linger will attempt to send the data, but after 2  
seconds will abort and not actually have sent all
the data.  Usually this is *much* more apparent when you have an  
application that does a send of 64k of
data then close the socket and you are using a dialup connection.



--
= 
= 
= 
========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
= 
= 
= 
========================================================================





More information about the Squeak-dev mailing list