working with client / servers

For general discussion related FlowStone
Post Reply
fixstuff555
Posts: 151
Joined: Thu Oct 21, 2010 3:24 pm

working with client / servers

Post by fixstuff555 »

Hello,

I am working on setting up a 2 port client / server interface between two computers. I have one FSM file on one computer, named "network_server_side", and one FSM file on another computer named "network_client_side". I got both connections to work, using ports 490 and 500 (I'm sure others would have worked fine), but I am trying to figure out the best way to accomplish something.

Two ports is fine for two pieces of data, or even opening more ports would get more data, however that is inefficient, especially considering I want to have maybe 20 or 30 channels worth. What I would like to do is a multiplexing scheme. One channel would be an index, and the other channel would be the data. I would then like to use the tick 25 or 100 primitive to step through the channels (lets say 10) that would allow me to have an input side and output side on each end of the connection. What would be the best method of accomplishing this? Would I use an index and then step through it or an array to do the same? There are a lot of ways to do this in Flowstone, and I was wondering what the best way is.

My goal here is for a nice pipeline between a main PC and a 2nd PC (like the Zotac HTPC I'm working on). This way I can tie in I/O, motors, etc, between the 2 flowstone apps, with a flowstone app as a GUI and supervisory controller, and 2nd flowstone app as a local i/o controller. This would most likely end up as a laptop for the Main PC, and the HTPC being mobile in a robot.

What would be really cool (this is a DSP Robotics Question btw) would be to have the "Bus Create" and "Bus Extract" primitives to work transparently over the server / client interface. I'm sure that code might be tricky, but it would possibly be perfect for what I'm trying to accomplish. You basically would get a bus over a network connection. Hmmm. a new primitive anyone? Just thinking.

Any opinions and examples would be welcome.
Attachments
network_server_side.fsm
(9.03 KiB) Downloaded 1370 times
network_client_side.fsm
(14.84 KiB) Downloaded 1387 times
Embedded
Posts: 143
Joined: Sat Oct 30, 2010 1:42 pm

Re: working with client / servers

Post by Embedded »

I think the easiest way is just to define your own protocol, this is what I do for the same task.

Since the data is a string you can have what ever you want:

"#01, MyData source 1"
"#99, MyData source 99"

Then just use the String Split or Sting to Sting Array to extract the data and the source etc.

Here's an example:
Attachments
Encode Decode.fsm
Encode-Decode
(1.4 KiB) Downloaded 1396 times
fixstuff555
Posts: 151
Joined: Thu Oct 21, 2010 3:24 pm

Re: working with client / servers

Post by fixstuff555 »

Yeah, that's probably much simpler. I thought there might be some other method I was overlooking, but I like that idea probably best. Thanks.
Post Reply