Opening Sockets on localhost

Till Bandi tbandi at swissonline.ch
Sun Mar 20 14:59:40 EST 2005


so Dan, don't forget, that is one of the subjects we are waiting for 
good explanations from someone that can well explain (and some of us - 
I think - even already paid for it?)  ;-)

Till

Am 16.03.2005 um 12:13 schrieb Alex Tweedly:

> Dan Shafer wrote:
>
>> Alex.....
>>
>> I got it. IOW, opening a socket doesn't work unilaterally. The 
>> "server" has to have a listener on that port first. Right?
>
> Right. When you open a TCP socket  (i.e. open socket to "host:port"), 
> a TCP connection is formed. A packet is sent from your machine's TCP 
> stack to his, and he sends a reply (assuming some application has done 
> "accept connection" on the correct port). If there is no-one listening 
> on that port, the remote machine will either ignore the incoming 
> packet, or send back a "reject" packet.
>
> When (if) your host receives a positive acknowledgment, then the 
> connection is successful (from your point of view); your TCP stack 
> then sends him back a third packet - and only when he receives it does 
> he consider the connection complete.  (He can't consider it complete 
> until then, because there could be a problem getting his packets to 
> you - the only way he knows that has succeeded is when you reply).  
> You may hear this referred to as "TCP's three-way handshake".
>
> Note that when you open a UDP socket (i.e. open datagram socket to 
> "host:port"), things are completely different. UDP (datagram) is 
> "connectionless", so the open socket does not cause any network 
> activity, and will generally succeed provided the "host:port" have 
> valid values.
>
>> I'm going to figure out this server stuff one of these days.
>
> And once you do, you'll realize how simple it all was to begin with, 
> and wonder why no-one ever wrote a decent explanation of it in the 
> first place. It's because most of us can't write decent explanations 
> of anything :-)
>
> -- 
> Alex Tweedly       http://www.tweedly.net
>
>
>
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list