Mumpster http://mumpster.org/ |
|
Socket Programming in GTM mump's http://mumpster.org/viewtopic.php?f=13&t=1672 |
Page 1 of 1 |
Author: | Paras [ Tue Dec 06, 2011 11:53 pm ] |
Post subject: | Socket Programming in GTM mump's |
Hello Friends.. I am new to this GTM mump's technology. I like to open a TCP port on the UNIX server and send the data over it , then one cache application will read this data from GTM-server port. Can any one help/assist me, how to write the code or if any one having such kind of ready made code then please share it? Following code I am trying to execute on the GTM server s tcpdev="TCP|9230" o tcpdev::2 u tcpdev r tcpdev ; this command will read the data from TCP. u tcpdev w tcpdev ; this line will write the data to TCP. Thanks in Advance!!!! Regards, Paras |
Author: | shabiel [ Thu Dec 15, 2011 11:20 am ] |
Post subject: | Re: Socket Programming in GTM mump's |
Check GT.M documentation for socket code from GT.M. http://tinco.pair.com/bhaskar/gtm/doc/b ... 09s07.html |
Author: | ramitvakil [ Fri Feb 17, 2012 4:14 am ] |
Post subject: | Re: Socket Programming in GTM mump's |
hi Paras You can try the below link and do inform me if it works ..... http://www.cyberciti.biz/faq/linux-unix-open-ports/ regards Ramit |
Author: | kirt [ Tue Mar 13, 2012 8:25 am ] |
Post subject: | Re: Socket Programming in GTM mump's |
You may find some helpful things about sockets and TCP interfacing under Rob Tweed's m/wire and or m/db tabs at www.mgateway.com. This projects are separate from EWD. They use GT.M and are also generously open source. K |
Author: | kirt [ Mon Oct 27, 2014 12:17 am ] |
Post subject: | Re: Socket Programming in GTM mump's |
Just to update this topic, EWDjs nicely implements json messages passed from browser-client to server-nodejs-gtm and gtm database on the server. These are Rob Tweeds work and Dave Wicksell's nodem to connect the nodejs and gtm on the server linux machine. See https://github.com/robtweed/ewd.js and gradvs1.mgateway.com/download/EWDjs.pdf Kirt |
Author: | jj547190 [ Wed Apr 13, 2016 12:11 am ] |
Post subject: | Re: Socket Programming in GTM mump's |
I agree with the second comment about that .... |
Author: | kanimiro [ Sun May 15, 2016 12:18 am ] |
Post subject: | Re: Socket Programming in GTM mump's |
thanks for this useful information...... |
Author: | cchilds [ Wed Jun 01, 2016 8:50 am ] |
Post subject: | Re: Socket Programming in GTM mump's |
I am not sure if this is the right place for this, but I had no idea about this webpage until recently and have enjoyed exploring. I work with Mumps (cache script) in relation to Epic Systems EMR, and sometimes I need to do some custom programming to do something I really want to do. I came here looking for some code to parse JSON from an http get request and didn't find it anywhere. Since I didn't find it I went ahead and wrote it myself, and I figured I would give back to the community by posting it here. It is all in line programming, just because sometimes my clients don't want new Routines written, so I bend the rules a little and create what Epic calls an Extension, which can have one line of code. First you have to get the JSON request. I thought it would be fun to show some weather conditions as a test. So start by setting the response variable to the JSON response of the wunderground API... Code: s server=”api.wunderground.com”,path=”/api/YOUR_KEY/conditions/q/MD/Baltimore.json” s httprequest=##class(%Net.HttpRequest).%New(),httprequest.Server=server d httprequest.Get(path) s response=httprequest.HttpResponse.Data.Read() Here is the code that parses the response variable and adds the data to the ^ZZJSON global. Code: s startcode="f i=1:1:len s ch=$e(response,i) q:ch=""{""",leveldown="s level=level-1,j=i+1 f i=j:1:len s ch=$e(response,i) q:(ch=""}"")!(ch=""{"")!(ch="","")!(ch="""""""")!(ch="":"")",rootsq="s level=1,string=$p($e(response,i,len),"""""""",2),j=i i 1 {f i=j:1:len s ch=$e(response,i) q:ch="":""} i 1 s ^ZZJSON(string)=1",storeroot="s ^ZZJSON(string)=1",coloncode="s j=i+1,val="""" i 1 {f i=j:1:len s ch=$e(response,i) q:(ch=""}"")!(ch=""{"")!(ch="","")!(ch="""""""") s:(i=j)&(ch'="" "") val=val_ch s:(i>j) val=val_ch} i 1 s ^ZZJSON(string)=$p(val,$c(10),1)",quotecode="s j=i+1,val="""",stop="""" i 1 {f i=j:1:len s ch=$e(response,i) s:ch="""""""" stop=1,ch=$e(response,i+1),i=i+1 q:stop=1 s val=val_ch} i 1 s ^ZZJSON(string)=val i (ch'="","") s j=i f i=j:1:len s ch=$e(response,i) q:(ch="":"")!(ch="","")!(ch=""{"")!(ch=""}"")",levelsq="s level=level+1,string=string_"",""_$p($e(response,i,len),"""""""",2),j=i i 1 {f i=j:1:len s ch=$e(response,i) q:ch="":""} i 1 s ^ZZJSON(string)=1",commacode="s j=i+1,string=$p($e(response,i,len),"""""""",2),^ZZJSON(string)=1 f i=j:1:len s ch=$e(response,i) q:ch="":""",levelcomma="s j=i+1,string=string_"",""_$p($e(response,i,len),"""""""",2) f i=j:1:len s ch=$e(response,i) q:ch="":""",buildstring="f jj=1:1:level-1 s:jj=1 newstring=newstring_$p(string,"","",jj) s:jj>1 newstring=newstring_"",""_$p(string,"","",jj)",len=$L(response),level="",ch="",string="",newstring="",val="" x startcode f q:i=len x:(ch="}") leveldown x:(ch="{")&(level="") rootsq x:(ch="{")&(level=1) levelsq x:(ch="{")&(level>1) levelsq x:ch=":" coloncode x:ch="""" quotecode s newstring="" x:(ch=",")&(level>1) buildstring s:(ch=",")&(level>1) string=newstring x:(ch=",")&(level>1) levelcomma x:ch="," commacode The JSON is stored in the ^ZZJSON global, respecting the child and parent structure. Now, you can retrieve the current temp in Baltimore by writing the global ^ZZJSON("current_observation,estimated,temp_f") Code: w !,"Temp: ",^ZZJSON("current_observation,estimated,temp_f") I just finished writing it, so it could possibly use some optimization, but it works. When I have time later I am going to clean up the root nodes that don't have a value to be just set to 1, but I really don't need them set to anything anyway. |
Author: | trice001 [ Tue Dec 05, 2017 3:28 am ] |
Post subject: | Re: Socket Programming in GTM mump's |
thanks |
Page 1 of 1 | All times are UTC - 8 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |