Guidance on use of Socket

John Thornborrow john at pinesoft.co.uk
Mon Dec 31 10:29:31 UTC 2007


Thanks, it makes sense to wait for a connection before waiting for
data..

John.

John M McIntosh wrote:
> 
> 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
> ===========================================================================
> 
> 
> 
> 


Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA



This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com




More information about the Squeak-dev mailing list