Open Socket Question

Dave dave at looktowindward.com
Tue Feb 26 09:56:24 EST 2008


Hi Phil,

Thanks a lot for this, the thing I was missing was the use of the  
sockeError/socketTimeout handlers.

All the Best
Dave


On 21 Feb 2008, at 21:36, Phil Davis wrote:

> Hi Dave,
>
> I don't have time to write sample code right now, but one approach  
> would be:
>
> - set the socketTimeoutInterval to something reasonable
> - make a 'connectToServerApp' handler that opens one socket, using  
> the params passed to it by 'startClient'
> - let 'StartClient' do this once for each line in your server list:
>      send ("connectToServerApp" && tOneIpAddress) to stack in 0 ticks
> - make a 'socketTimeout' handler than resends the  
> 'connectToServerApp' cmd (with params) to stack in x ticks
> - make a 'socketError' that notifies you of connection failures
> - when the openSockets contains all the addresses in your original  
> list, you're done
>
> Phil Davis
>
>
> Dave wrote:
>> Hi All,
>>
>> I have a number of applications that communicate with each other  
>> using TCP/IP Sockets. For a given application, I want to be able  
>> to connect it to a number of "server" applications, however the  
>> "server" apps make or may not be running, so what I want to be  
>> able to do is to issue an open socket to a "server" application  
>> and if the connection is made add it to a "connected" table and if  
>> not, carry on the to next server, but try to open the socket again  
>> at a later time.
>>
>> I can't seem to be able to get my head around the code needed to  
>> do this!
>>
>> Basically I have a Function that gets called with a list of the IP  
>> Addresses in the for - aa.bb.cc.dd:port and a ConnectionID, I want  
>> to be able to open a socket to each IP/Port with the specified  
>> ConnectionID . The function definition for this is as follows:
>>
>> function StartClient theConnectToServerList,theConnectionID
>>
>> theConnectToServerList is a list of the following
>>
>> 192.168.1.100:6000
>> 192.168.1.100:6002
>> 192.168.1.100:6004
>>
>> etc.
>>
>> Any ideas on how achieve this gracefully would be greatly  
>> appreciated!
>>
>> All the Best
>> Dave
>>
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> -- 
> Phil Davis
>
> PDS Labs
> Professional Software Development
> http://pdslabs.net
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>





More information about the use-livecode mailing list