Hello All,
(B
(BSpent a long day yesterday! Both figuring out a "solution" to a
(Bmultiple-ports problem, and realizing finally that my understanding of Rev's
(Bimplementation of sockets is seriously flawed. Specifically, the problem
(Bthis time seems to be my unclear understanding of how Rev identifies sockets
(Bto and from a single port.
(B
(BI was hoping someone might care to comment on the following before-and-after
(Bscript outlines, perhaps even going so far as to also suggest a simpler way.
(BAppended below, too, is the perhaps relevant sections from the Rev
(Bdocumentation, but the implementation of which I'm afraid I could not
(Bunderstand (i.e., how or where to actually refer in a script to a
(Bnon-numeric socket identifier I've arbitrarily assigned).
(B
(BAs always, thank you... and a Happy Year of The Chicken!
(B
(BCheers,
(BNicolas Cueto
(B
(B--------------------------------------
(B######THE "BEFORE" SCRIPT##########
(Blocal tRawData
(B
(Bon openCard
(B accept connections on port 8080 with message "netConnect"
(B open socket to "192.168.1.11:8025" with message "sendItOne"
(B open socket to "192.168.1.11:8025" with message "sendItTwo"
(Bend openCard
(B
(Bon netConnect incomingMessage
(B read from socket incoming message until [arbitrary end marker]
(B put it into receivedData
(B close socket incomingMessage
(B if "[request 1]" is in receivedData then
(B put receivedData into tRawData
(B processRawData
(B end if
(B if "[request 2]" is in receivedData then
(B put receivedData into tRawData
(B processRawData
(Bend netConnect
(B
(Bon processRawData
(B if "[request 1]" is in tRawData then do stuff on local stack
(B if "[request 2]" is in tRawData then do other stuff on local stack
(Bend processRawData
(B
(Bon sendItOne sOne
(B put "[request1]" into tData
(B write tData to socket sOne
(B close socket sOne
(Bend sendItOne
(B
(Bon sendItTwo sTwo
(B put "[request2]" into tData
(B write tData to socket sTwo
(B close socket sTwo
(Bend sendItOne
(B
(B########## THE "AFTER" SCRIPT############
(Blocal tRawDataOne, tRawDataTwo
(B
(Bon openCard
(B accept connections on port 8080 with message "netConnectOne"
(B accept connections on port 8081with message "netConnectOne"
(B open socket to "192.168.1.11:8025" with message "sendItOne"
(B open socket to "192.168.1.11:8026" with message "sendItTwo"
(Bend openCard
(B
(Bon netConnectOne incomingMessageOne
(B read from socket incoming messageOne until [arbitrary end marker]
(B put it into receivedData
(B close socket incomingMessageOne
(B if "[request 1]" is in receivedData then
(B put receivedData into tRawDataOne
(B processRawDataOne
(Bend netConnectOne
(B
(Bon netConnectTwo incomingMessageTwo
(B read from socket incoming messageTwo until [arbitrary end marker]
(B put it into receivedData
(B close socket incomingMessageTwo
(B if "[request 1]" is in receivedData then
(B put receivedData into tRawDataTwo
(B processRawDataTwo
(Bend netConnectOne
(B
(Bon processRawDataOne
(B do stuff on local stack
(Bend processRawDataOne
(B
(Bon processRawDataTwo
(B do other stuff on local stack
(Bend processRawDataTwo
(B
(Bon sendItOne sOne
(B put "[request1]" into tData
(B write tData to socket sOne
(B close socket sOne
(Bend sendItOne
(B
(Bon sendItTwo sTwo
(B put "[request2]" into tData
(B write tData to socket sTwo
(B close socket sTwo
(Bend sendItOne
(B
(B#########REV DOC: accept command###########
(BWhen a connection is made or a datagram is received, the accept command
(Bcreates a new socket that can be used to communicate with the other system
(B(or process). When using the close socket, read from socket, or write to
(Bsocket commands, you can refer to this socket with a socket identifier that
(Blooks like this:
(B
(B host:port[|connectionID]
(B
(Bwhere the connectionID is a number assigned by the accept command. (You only
(Bneed to specify the connection number if there is more than one socket
(Bconnected to a particular port and host.)
(B
(B#########REV DOC:open socket command#######
(BNote: When the accept command creates a socket, it assigns a number as the
(Bconnection name. If you are using both the open socket command and the
(Baccept command to connect to the same port on the same host, make sure to
(Buse a non-numeric connection name that won?t conflict with the numbers
(Bassigned by the accept command. This ensures that you can always refer to
(Btwo different sockets by distinct socket identifiers.
(B_______________________________________________
(Buse-revolution mailing list
([email protected]
(Bhttp://lists.runrev.com/mailman/listinfo/use-revolution