Opening a network connection

279 views
Skip to first unread message

Victor Wong

unread,
May 2, 2013, 9:05:51 PM5/2/13
to personal...@googlegroups.com
I understand that hopen opens either a file or an IPC connection to another kdb process.  Is there any way to open a simple character connection to a network host, ala telnet?  I also saw that one could use the following syntax: `:http://hostname "GET x" to open a character connection and retrieve a response (in this case HTML from a HTTP server), but I don't know if there is a different syntax to keep the connection open?  I am trying to open a session with a server that speaks a simple textual protocol and would prefer to do it in q.

Thanks in advance,
Victor

Victor Wong

unread,
May 3, 2013, 12:40:48 AM5/3/13
to personal...@googlegroups.com
Thanks, John.  I am actually not trying to connect to another kdb process, but to a server that uses a textual protocol, like HTTP or SMTP (for example).  Conceptually, it's basically the same as sending strings synchronously back and forth like in your example, except without the serialization.

On Thursday, May 2, 2013 6:13:47 PM UTC-7, John Dempster wrote:
You can send strings of commands using the handle hopen returns.

~JD

Ryan Hamilton

unread,
May 3, 2013, 6:11:41 AM5/3/13
to personal...@googlegroups.com
Hi Victor,

I think your only option for a constantly open connection is to extend kdb with some C code. The rserve code allows connecting and sending text commands to an R server from within q, it may be useful to look at.
http://code.kx.com/wsvn/code/cookbook_code/r/rserve/

If you just wanted to synchronously download some data, you could use a command line tool from within q to download it to file, then read the file.

Regards,
Ryan
--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to personal-kdbpl...@googlegroups.com.
To post to this group, send email to personal...@googlegroups.com.
Visit this group at http://groups.google.com/group/personal-kdbplus?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


-- 
TimeStored.com - KDB+ Training, Consulting, Software

WooiKent Lee

unread,
May 3, 2013, 8:23:25 AM5/3/13
to personal...@googlegroups.com
You can look about here:

http://code.kx.com/wsvn/code/contrib/rpairceir/KDB%20TCP/?#af1754533edd3a736885f54cb836c52b3

Just a simple code where a C based TCP data feeder sending random strings to a q session. Hopefully it can help you though.
Reply all
Reply to author
Forward
0 new messages