I have been testing Xojo 2014r1. Everything has been good up until now. I need to communicate with a networked gage. I have code in php that works.
Below are snippets of my code. php is working. xojo is not. I can tell from my network gage that the xojo code is making a connecting and not sending any data after (and including) the null character. If I have a long command without a null character, xojo works fine. If there is a null character in the middle of the command, the gage receives everything before the null character. If the null character is first (like my code below), the gage receives nothing other than the connection.
I have tried chrb, flushing the socket, delays,etc. I even created a generic winsock program in VB6 to show me what was being sent and it verifies the problem. Has anyone found a solution for this?
Thanks for the response. I tried chrb and it didn’t make a difference. All commands with chr and chrb as long as there is no chr(0) or chrb(0). Unfortunately, the most important command has null these.
Forgive me. I am very new to Xojo. Where would I find this frame with hex values? Basically I created a form with a pushbutton that executes the socket code for testing purposes.
Missed that
Its still early here
I can say that I have code thats been running for nearly 8 years now that reads & writes lots of binary data including chrb(0) etc
Well, I could try your example exactly since I can’t run more than one instance of Xojo BUT I modified it send code to my gage. I cut and paste the send code I was using into action events of pushbuttons and changed to the tcpsocket1. It works!
The only differences are using the tcpsocket control and receiving data using its DataAvailable event instead of reading after the send. I don’t understand why the control works and creating the socket in code doesn’t but I guess it doesn’t matter
Thanks again for the help! That was the last roadblock I had to purchasing Xojo Pro
[quote=77819:@Aaron Murray]Well, I could try your example exactly since I can’t run more than one instance of Xojo
[/quote]
You only need one with two projects open Thats how I tried it out
[quote=77819:@Aaron Murray]BUT I modified it send code to my gage. I cut and paste the send code I was using into action events of pushbuttons and changed to the tcpsocket1. It works!
The only differences are using the tcpsocket control and receiving data using its DataAvailable event instead of reading after the send. I don’t understand why the control works and creating the socket in code doesn’t but I guess it doesn’t matter
Thanks again for the help! That was the last roadblock I had to purchasing Xojo Pro :)[/quote]
Reading immediately after sending may not have any data available
Sockets are most definitely event driven and dealing with them that way makes the most sense
The simplest way to do that is to subclass it and implement the events in your subclass and then just create & use instances of your subclass