Open Socket Question

Alex Tweedly alex at tweedly.net
Thu Feb 28 16:40:00 EST 2008


Sorry I'm late replying - time zone differences can be a real nuisance 
:-)   It looks from later email that you've already figured out these 
answers - but I'll answer them for the sake of completeness for anyone 
reading the threads later.

Dave wrote:
>
>
> The Server can "Accept" connections from a number of Clients, surely 
> if I close the port, then no other clients will be able to connect. Or 
> do you mean I should (on the Server) close the connection that is 
> presented to the "ServerContactedByClient" handler? e.g. the 
> IP/Port?ConnectionID of the Client?
>
Indeed - in your code you would do something like
   set the itemDel to ":"
   if item 1 of theIPAddress is not among the lines of 
gAllowedClientList then
        close socket theIPAddress
        exit ServerContactedByClient
    end if

>> Also, I'm curious.This is probably just because you've snipped code 
>> to send it here, but just in case it isn't ....
>>
>> you look at "the result" immediately - what do you expect it to 
>> contain at that point ?
>
> I think this was a snipping problem as you say, before I wasn't using 
> a Callback Handler and so I needed to check the result after the 
> command returned.  However, do need to check "the result" after the 
> Accept command?:
>
>   accept connections on theServerPortNumber with message 
> "ServerContactedByClient"
>
No, there should be no need to do that.  Though if there is a 
possibility of multiple applications trying to accept on the same port, 
that may be different.

See later reply to other emails ...
-- 

Alex Tweedly      mailto:alex at tweedly.net      www.tweedly.net




More information about the Use-livecode mailing list