It is currently Tue Nov 21, 2017 4:55 am


All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Socket Programming in GTM mump's
PostPosted: Tue Dec 06, 2011 11:53 pm 

Joined: Tue Dec 06, 2011 11:31 pm
Posts: 1
Real Name: Paras Batheja
Began Programming in MUMPS: 02 Dec 2011
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


Top
Offline Profile  
 
 Post subject: Re: Socket Programming in GTM mump's
PostPosted: Thu Dec 15, 2011 11:20 am 

Joined: Tue Dec 07, 2010 3:45 am
Posts: 26
Real Name: Sam Habiel
Began Programming in MUMPS: 02 Dec 2006
Check GT.M documentation for socket code from GT.M.

http://tinco.pair.com/bhaskar/gtm/doc/b ... 09s07.html


Top
Offline Profile  
 
 Post subject: Re: Socket Programming in GTM mump's
PostPosted: Fri Feb 17, 2012 4:14 am 

Joined: Fri Feb 17, 2012 3:20 am
Posts: 2
Real Name: Ramit Vakil
Began Programming in MUMPS: 11 Feb 2012
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


Top
Offline Profile  
 
 Post subject: Re: Socket Programming in GTM mump's
PostPosted: Tue Mar 13, 2012 8:25 am 

Joined: Tue Mar 13, 2012 8:16 am
Posts: 3
Real Name: Kirt Walker
Began Programming in MUMPS: 06 Jan 1972
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


Top
Offline Profile  
 
 Post subject: Re: Socket Programming in GTM mump's
PostPosted: Mon Oct 27, 2014 12:17 am 

Joined: Tue Mar 13, 2012 8:16 am
Posts: 3
Real Name: Kirt Walker
Began Programming in MUMPS: 06 Jan 1972
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


Top
Offline Profile  
 
 Post subject: Re: Socket Programming in GTM mump's
PostPosted: Wed Apr 13, 2016 12:11 am 

Joined: Wed Apr 13, 2016 12:10 am
Posts: 1
Real Name: steve steve
Began Programming in MUMPS: 01 Jan 1989
I agree with the second comment about that ....

_________________
Graduated from Soran University with First Class Degree with Honours in Computer Science.


Top
Offline Profile  
 
 Post subject: Re: Socket Programming in GTM mump's
PostPosted: Sun May 15, 2016 12:18 am 

Joined: Sun May 15, 2016 12:17 am
Posts: 1
Real Name: [please delete me - I am a spam pseudo-user]
Began Programming in MUMPS: 01 Jan 1990
thanks for this useful information......

_________________
Graduated from Soran University with First Class Degree with Honours in Computer Science.


Top
Offline Profile  
 
 Post subject: Re: Socket Programming in GTM mump's
PostPosted: Wed Jun 01, 2016 8:50 am 

Joined: Wed Jun 01, 2016 8:12 am
Posts: 2
Real Name: Christopher Childs
Began Programming in MUMPS: 03 Jan 2007
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.


Top
Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net