Open Socket Question
revdev at pdslabs.net
Thu Feb 21 16:36:56 EST 2008
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,
> 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
> Any ideas on how achieve this gracefully would be greatly appreciated!
> All the Best
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
Professional Software Development
More information about the Use-livecode