techjunkie09 Posted July 21, 2009 Share Posted July 21, 2009 Is it possible to make a lisp communicate with a server? Example would be that data for a series of diagrams could be stored using an sql database on a server and the lisp could be used to load the data off the shared database Quote Link to comment Share on other sites More sharing options...
Se7en Posted July 21, 2009 Share Posted July 21, 2009 yep. "GetRemoteFile": part of the utility object Quote Link to comment Share on other sites More sharing options...
Patrick_35 Posted July 21, 2009 Share Posted July 21, 2009 Hi With autolisp, no, but with vlisp, yes Look vla-putremotefile/vla-getremotefile or with (setq ado (vlax-create-object "ADODB.Stream")) or (or (setq http (vlax-create-object "MSXML2.XMLHTTP")) (setq http (vlax-create-object "Microsoft.XMLHTTP")) ) @+ Quote Link to comment Share on other sites More sharing options...
techjunkie09 Posted July 21, 2009 Author Share Posted July 21, 2009 hate to be a little lazy on this bit, but is it possible to send an HTTP POST request with vlisp? Basically i'd like to have the lisp send a string of text to the server then have the server respond with a number, i can handle the server bit i just need to know how to send the request and how it receives a response Quote Link to comment Share on other sites More sharing options...
Se7en Posted July 21, 2009 Share Posted July 21, 2009 nope. you can maybe hack something with the windows scripting host but... Quote Link to comment Share on other sites More sharing options...
Patrick_35 Posted July 21, 2009 Share Posted July 21, 2009 Yes Use (or (setq http (vlax-create-object "MSXML2.XMLHTTP")) (setq http (vlax-create-object "Microsoft.XMLHTTP")) ) And see that or that @+ Quote Link to comment Share on other sites More sharing options...
Se7en Posted July 21, 2009 Share Posted July 21, 2009 whoa ... holly cool batman. That's going in my library. Quote Link to comment Share on other sites More sharing options...
techjunkie09 Posted July 21, 2009 Author Share Posted July 21, 2009 *drools* nice work patrick :) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 21, 2009 Share Posted July 21, 2009 Very nice Patrick, I am impressed Lee Quote Link to comment Share on other sites More sharing options...
Freerefill Posted July 22, 2009 Share Posted July 22, 2009 Very nice. I'm definitely going to look into this further. Can you use this to change stuff on a server as well? Like, take a file (say a simple text file), alter its contents and save it? Quote Link to comment Share on other sites More sharing options...
Patrick_35 Posted July 22, 2009 Share Posted July 22, 2009 Very nice. I'm definitely going to look into this further. Can you use this to change stuff on a server as well? Like, take a file (say a simple text file), alter its contents and save it? Hi Yes, you can download a file, change it and upload An example to download (without vla-getremotefile) (defun download (url dir / byte fic file fso http ok tbl taille) (setq http (vlax-create-object "MSXML2.XMLHTTP") fso (vlax-create-object "Scripting.FileSystemObject") file (strcat dir (vl-filename-base url) (vl-filename-extension url))) (vlax-invoke-method http 'open "get" url :vlax-false) (if (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list http 'send))) (princ (strcat "\nLe lien " url " n'est pas valide.")) (if (eq (vlax-get http 'status) 200) (if (vl-catch-all-error-p (setq taille (vl-catch-all-apply 'vlax-invoke (list http 'getResponseHeader "Content-Length")))) (princ "\nErreur de lecture sur la taille du fichier.") (if (< (atoi taille) (vlax-get (vlax-invoke fso 'getdrive (substr (vlax-invoke fso 'getabsolutepathname file) 1 1)) 'freespace)) (progn (princ "\nTéléchargement en cours...")(princ) (while (not (eq (vlax-get http 'readystate) 4)) (vla-eval (vlax-get-acad-object) "DoEvents") ) (setq tbl (vlax-safearray->list (vlax-variant-value (vlax-get-property http 'responsebody)))) (if (vl-catch-all-error-p (setq fic (vl-catch-all-apply 'vlax-invoke (list fso 'createtextfile file)))) (princ (strcat "\nImpossible de créer le fichier " file)) (progn (foreach byte tbl (vlax-invoke fic 'write (vl-list->string (list byte))) ) (vlax-invoke fic 'close) (setq ok T) ) ) ) ) ) (princ (strcat "\n" (vlax-get http 'statustext) "...Erreur " (itoa (vlax-get http 'status)) ".")) ) ) (vlax-release-object http) (vlax-release-object fso) ok ) (download "http://carnet-de-cablage.chez-alice.fr/Lisp/Latt.zip" "c:/") @+ Quote Link to comment Share on other sites More sharing options...
Freerefill Posted July 22, 2009 Share Posted July 22, 2009 Wow.. that is so awesome.. I can make 2-player Internet Pong with that.. or an AutoCAD MUD... You've given me a new toy to play with. :3 Quote Link to comment Share on other sites More sharing options...
Quest for Peace Posted March 6, 2017 Share Posted March 6, 2017 I don't understand where/how to get a url for a file (for get) or directory (for put). Can this be on my local pc, or does it have to be hosted on an http file server? Where do you host it? My end goal (in case this is already done), is to set up a sort of license server. It should check remotely for a valid license (if this is a slow process, it could be once per day) and then send out information about the drawing being worked on. Like directory path, etc. Sorry once again if the answer is obvious. I'm still a total amateur who gets stuff done by just investing the hours needed for trial and error programming. I spent 4 hours this weekend to figure out Amazon AWS from the command line. That works pretty cool, it uses a line of text at the command prompt to transfer files. But I couldn't seem to "command" the line from within lisp, in a way that waited for the AWS response. Maybe I was doing it wrong? I was trying "_.script" So I guess that's 2 questions in one. URL to a local pc, or where is it? And running a line of script for Windows. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted March 7, 2017 Share Posted March 7, 2017 Search here for words like remote & license & protection & ??? it was a long time ago but it was same question how to get a license request from remote server. Or google. I downloaded it but never used it, now where did I put it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.