SKSocket connected with my socket server
-
Hello everybody,
I wrote a small socket server to transport data between Sketchup and a PC over my LAN network.
The SKSocket can connect and send data to my server without problems (FYI : String are send with UTF8 encoding)
But (There is always a "but"...) when my server want to reply or send data to Sketchup : the SKSocket_listener isn't triggered
So I have captured the TCP stream with Wireshark (see image) and the TCP message is ACK by Sketchup but never seen in Ruby.
Is there someone with a idea for this problem ?
-
The SKSocket class is undocumented and officially unsupported by Google.
Can you post a minimal code snippet of what you have so far?
-
Hello Morgan,
Although you can hack a solution that will work in your lab network, because of NAT and firewall rules this connectivity solution will be more trouble than its worth at customers sites.
%(#0000BF)[In any case sketchups native UI.messagbox and UI.inputbox are not sufficient for a reasonable user interface so you must use sketchups Webdialog anyway.
During the developent of the plugin you will need a "debug" interface from which you can manually send data either way and monitor results, so you must pass "complex" data structures to and from the webdialog !]If the assumptions above are indeed relevant to your case, use javascript ajax in sketchups webdialog to connect to the other data computer.
Use Base64 encoding to pass complex data stuctures from Ruby to Javascript and on to the data computer and back. I also save Base64 encoded data structures in sketchups attribute dictionaries, to never worry about escaping illegal characters and binary data structures etc.
I also use webdialog textboxes for monitoring sent and received data and manually injecting test data.Note the 2 KiloByte limit of each call from webdialog javascript to sketchup ruby - split longer data.
-
Hello,
Thanks for your answer and your way to send datas through a Webdialog using ajax.
For the SKSocket class, I have asked to Scott (a Googler) at the Basecamp and the response is this class as been developed for an internal test but it's not fully implemented and fully working so don't use it if you want to be sure your code will run correctly.
Regarding my needs : Now I just want to handles events from another windows software directly inside Ruby so I'll open another topic in the forum.
Advertisement