multiple local sockets
alex at tweedly.net
Thu Dec 30 19:14:24 CST 2004
Nicolas Cueto wrote:
>I was hoping someone might care to comment on the following before-and-after
>script outlines, perhaps even going so far as to also suggest a simpler way.
It might be easier to suggest a simpler way if you could explain what
you *want* to do.
Suggesting changes to the code you give leaves the possibility that we
miss a really simple way because of the assumptions you have already
made in the code you provide.
>Appended below, too, is the perhaps relevant sections from the Rev
>documentation, but the implementation of which I'm afraid I could not
>understand (i.e., how or where to actually refer in a script to a
>non-numeric socket identifier I've arbitrarily assigned).
You can simply say something like
open socket "192.168.0.1:8080|myconnectionname" with message "sendItOne"
and then you have given a connection name which will never conflict with
one that accept will give.
The next paragraph says (or at least, I read it as saying) that "accept"
will only ever use numeric values for the ID part - hence will never
conflict if you use a non-numeric ID like "myconnectionname"
>#########REV DOC: accept command###########
>When a connection is made or a datagram is received, the accept command
>creates a new socket that can be used to communicate with the other system
>(or process). When using the close socket, read from socket, or write to
>socket commands, you can refer to this socket with a socket identifier that
>looks like this:
>where the connectionID is a number assigned by the accept command. (You only
>need to specify the connection number if there is more than one socket
>connected to a particular port and host.)
>#########REV DOC:open socket command#######
>Note: When the accept command creates a socket, it assigns a number as the
>connection name. If you are using both the open socket command and the
>accept command to connect to the same port on the same host, make sure to
>use a non-numeric connection name that won?t conflict with the numbers
>assigned by the accept command. This ensures that you can always refer to
>two different sockets by distinct socket identifiers.
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.6 - Release Date: 28/12/2004
More information about the use-livecode