Pass measages

Discuss PC Developer and Web Developer projects and features here.
BenR
Matrix Staff
Posts: 1706
http://meble-kuchenne.info.pl
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: Pass measages

Post by BenR »

Slight tickle to the client code here to make the comms run faster. If we have no data to receive then we don't wait the timeout period any more.
AD_CLient.fcsx
(19.9 KiB) Downloaded 170 times
I've also addd the examples to this page on the wiki.
https://www.flowcode.co.uk/wiki/index.p ... r_Examples

wayne_millard
Posts: 94
Joined: Fri Dec 04, 2020 6:12 pm
Has thanked: 1 time
Been thanked: 9 times

Re: Pass measages

Post by wayne_millard »

Hi,

How do I send and receive strings?.

Thanks,

Wayne Millard

BenR
Matrix Staff
Posts: 1706
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: Pass measages

Post by BenR »

Hello,

Sending a string should be simple enough,

To send a string from the client to the server you would construct a command using the standard approach e.g. : followed by the command code. Next if you want to send multiple strings you might send an index byte. Next you would send the string data a byte at a time followed by sending a 0 or null byte. Finally send the command end ;\n. The server would receive the command and then pull data into a string a byte at a time until the null value is received.

To send a string from the server to the client you again would issue the command from the client, again maybe with an index to specify one out of a number of strings. Then the server would respond with the string data and null byte. The client should try and pull in a maximum number of bytes e.g. 255 and this can put it into a special case where it knows it's receiving a string and will receive until it collects the null byte.

I can edit the examples with this functionality if it would help.

wayne_millard
Posts: 94
Joined: Fri Dec 04, 2020 6:12 pm
Has thanked: 1 time
Been thanked: 9 times

Re: Pass measages

Post by wayne_millard »

Hi Ben,

Would love to see a example it would help a lot.

Thank you for your help.

Wayne M

BenR
Matrix Staff
Posts: 1706
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: Pass measages

Post by BenR »

Ok here you go, I've added commands C and D to send and receive string data and added an index byte into each command to make it easier to assign the values to useful things without having to create more unique commands.

For the client the index is specified as a parameter to the set/get macro.
For the server the index is processed in each branch of the ProcessCommand macro

AD_Client.fcsx
(29.26 KiB) Downloaded 163 times
AD_Server.fcsx
(32.41 KiB) Downloaded 165 times

Hopefully makes things a bit easier to work with.

wayne_millard
Posts: 94
Joined: Fri Dec 04, 2020 6:12 pm
Has thanked: 1 time
Been thanked: 9 times

Re: Pass measages

Post by wayne_millard »

Hi Ben,

I have tried to intergrate the server and client into project but have problems.
I have a App Developer app that get information from a device with a Xport ethernet to serial comms device on.
So app communicates with devide using IP address and port number that all works ok.
Want to send data to a second computer using another app using your server and client.
I can get any of the two working by them self but not to geather.
What do i need to i have tried everything.

Thanks,
Wayne M :oops: :oops:

BenR
Matrix Staff
Posts: 1706
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: Pass measages

Post by BenR »

Hi Wayne,

Do you have two network comms components in your program or are you trying to pipe all the comms through one? I think you will need to have two components if you don't already.

wayne_millard
Posts: 94
Joined: Fri Dec 04, 2020 6:12 pm
Has thanked: 1 time
Been thanked: 9 times

Re: Pass measages

Post by wayne_millard »

Hi Ben,

I tried it first with two ethernet component's but could not get that to work and then tried one and can't get that working. So very stuck.

Thanks
Wayne M

BenR
Matrix Staff
Posts: 1706
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: Pass measages

Post by BenR »

Hi Wayne,

Ok thanks I'm looking into it for you now.

wayne_millard
Posts: 94
Joined: Fri Dec 04, 2020 6:12 pm
Has thanked: 1 time
Been thanked: 9 times

Re: Pass measages

Post by wayne_millard »

Thanks Ben
It seems as if I use two ethernet com component's one affects the other from working.

Wayne

Post Reply