Re: Communication between C++ server and Python app

2013-03-23 Thread premiumtelco
I normally wouldn’t be able to find such great content as this on other
sites. You have done a great job with each unique point made on this topic.
Thank you for your hard work.





-
premium rate numbers 
Click Here 
premiumtelco 
--
View this message in context: 
http://python.6.n6.nabble.com/Communication-between-C-server-and-Python-app-tp4937660p5011431.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-05-09 Thread Jean-Michel Pichavant

kenk wrote:

Hi,

I've got a server process written in C++ running on Unix machine.
On the same box I'd like to run multiple Python scripts that will
communicate with this server.

Can you please suggest what would be best was to achieve this ?

Kind regards and thanks in advance!
M.
  

xmlrpc shoudl do it.

http://en.wikipedia.org/wiki/XML-RPC

There's is a client/server python module fort that, same for C++. Your 
python client will be able to call C++ server procedures.


It could be slighlty overkill but that get rid of the tedious socket 
programming.


JM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-05-01 Thread Adam Tauno Williams
On Sat, 2012-04-28 at 17:45 -0700, kenk wrote: 
> I've got a server process written in C++ running on Unix machine.
> On the same box I'd like to run multiple Python scripts that will
> communicate with this server.
> Can you please suggest what would be best was to achieve this ?

Time to start using a message broker that can also grow to other
applications.

RabbitMQ.  Simple, fast, and easy to manage.


This allows each service to have outages without loosing information.


signature.asc
Description: This is a digitally signed message part
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-04-30 Thread Miki Tebeka
> > I've got a server process written in C++ running on Unix machine.
> > On the same box I'd like to run multiple Python scripts that will
> > communicate with this server.
> > 
> > Can you please suggest what would be best was to achieve this ?
As said before, there are many options. Here are some:
* protobuf, thrift, avro ...
* json/xml over http
   - Python has XMLRPC module
* zeromq
* ...

IMO investigate some time learning the options, code a simple api using one or 
two that you like and pick a winner.

For 10 calls/min you can go that wrong either way :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-04-30 Thread kenk
Failr point  - I should do that in original question.

The C++ server runs on Unix (Mac OS X as a matter of fact) and, as I'm
the one who develops it, can use whthever technology is suitable.
Currently it uses STL, Boost and Qt libraries.

The server is responsible for providing connectivity to stock exchange
and will be used mainly to monitor price of certain financial
instruments and placing/cancelling orders.
My idea is to keep this as simple tool that will execute whathever
it's asked for.

On top of this server I plan to write some trading logic in Python -
scripts that will trigger certain actions depending on situation on
market.

I planned to exchange text commands between the C++ server and Python
scripts as Python is really good in parsing text and on server side
Boost/STL also do the trick.
Communication between 'logic' and the server won't be high frequency -
I plan to talk to teh server ~10 times a minute.

Will appreciate suggestions.

M.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-04-29 Thread Cameron Simpson
On 29Apr2012 21:08, Chris Angelico  wrote:
| On Sun, Apr 29, 2012 at 4:24 PM, Cameron Simpson  wrote:
| > On 29Apr2012 11:42, Chris Angelico  wrote:
| > | Personally, I would recommend a TCP socket, because that allows the
| > | flexibility of splitting across multiple computers.
| >
| > And the pain of ensuring security, if you're in an open network.
| 
| You have that with all IPC. You can always bind to 127.0.0.1 or ::1 to
| stop other hosts from connecting; and then it's minimal change to open
| it up.

I'm as concerned with other users as with other hosts. Hence the pleasures of
UNIX permissions on a socket. You're right, I did say "open network", didn't
I? Nonetheless, my preference stands unless a new use case arises.

Cheers,
-- 
Cameron Simpson  DoD#743
http://www.cskk.ezoshosting.com/cs/

Just because Unix is a multiuser system doesn't mean I want to share it with
anybody!- Paul Tomblin, in rec.aviation.military
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-04-29 Thread Marcin Maksymiuk
Failr point  - I should do that in original question.

The C++ server runs on Unix (Mac OS X as a matter of fact) and, as I'm the one 
who develops it, can use whthever technology is suitable. 
Currently it uses STL, Boost and Qt libraries.

The server is responsible for providing connectivity to stock exchange and will 
be used mainly to monitor price of certain financial instruments and 
placing/cancelling orders.
My idea is to keep this as simple tool that will execute whathever it's asked 
for.

On top of this server I plan to write some trading logic in Python - scripts 
that will trigger certain actions depending on situation on market.

I planned to exchange text commands between the C++ server and Python scripts 
as Python is really good in parsing text and on server side Boost/STL also do 
the trick.
Communication between 'logic' and the server won't be high frequency - I plan 
to talk to teh server ~10 times a minute.

Will appreciate suggestions.

M.



On 29 Apr 2012, at 05:00, Rodrick Brown wrote:
>   
> Sent from my iPad
> 
> On Apr 28, 2012, at 8:45 PM, kenk  wrote:
> 
>> Hi,
>> 
>> I've got a server process written in C++ running on Unix machine.
>> On the same box I'd like to run multiple Python scripts that will
>> communicate with this server.
>> 
>> Can you please suggest what would be best was to achieve this ?
>> 
>> Kind regards and thanks in advance!
>> M.
>> -- 
>> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-04-29 Thread Chris Angelico
On Sun, Apr 29, 2012 at 4:24 PM, Cameron Simpson  wrote:
> On 29Apr2012 11:42, Chris Angelico  wrote:
> | Personally, I would recommend a TCP socket, because that allows the
> | flexibility of splitting across multiple computers.
>
> And the pain of ensuring security, if you're in an open network.

You have that with all IPC. You can always bind to 127.0.0.1 or ::1 to
stop other hosts from connecting; and then it's minimal change to open
it up.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-04-29 Thread Tamer Higazi
Take the twisted library.
I used to write myself a socket server and client.

Socket is fast, but you need on the other hand to know how big the
dataset might be, that will be serialized and deserialized as well.



Tamer

Am 29.04.2012 08:24, schrieb Cameron Simpson:
> On 29Apr2012 11:42, Chris Angelico  wrote:
> | On Sun, Apr 29, 2012 at 10:45 AM, kenk  
> wrote:
> | > I've got a server process written in C++ running on Unix machine.
> | > On the same box I'd like to run multiple Python scripts that will
> | > communicate with this server.
> | >
> | > Can you please suggest what would be best was to achieve this ?
> | 
> | Personally, I would recommend a TCP socket, because that allows the
> | flexibility of splitting across multiple computers.
> 
> And the pain of ensuring security, if you're in an open network.
> 
> | But for
> | efficiency, you may want to consider a Unix socket too.
> 
> A UNIX socket or even a named pipe has the benefit of:
>   - not being available remotely
>   - access control with normal UNIX permissions
> and of course efficiency as you say.
> 
> Generalising to a TCP socket later shouldn't be too hard if the need
> arises.
> 
> Cheers,

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-04-28 Thread Cameron Simpson
On 29Apr2012 11:42, Chris Angelico  wrote:
| On Sun, Apr 29, 2012 at 10:45 AM, kenk  
wrote:
| > I've got a server process written in C++ running on Unix machine.
| > On the same box I'd like to run multiple Python scripts that will
| > communicate with this server.
| >
| > Can you please suggest what would be best was to achieve this ?
| 
| Personally, I would recommend a TCP socket, because that allows the
| flexibility of splitting across multiple computers.

And the pain of ensuring security, if you're in an open network.

| But for
| efficiency, you may want to consider a Unix socket too.

A UNIX socket or even a named pipe has the benefit of:
  - not being available remotely
  - access control with normal UNIX permissions
and of course efficiency as you say.

Generalising to a TCP socket later shouldn't be too hard if the need
arises.

Cheers,
-- 
Cameron Simpson  DoD#743
http://www.cskk.ezoshosting.com/cs/

Waiting for the bus is a bad idea if you turn out to be the bus driver.
- Michael M. Butler on the Singularity
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-04-28 Thread Rodrick Brown
What interfaces are available on the server process? 

Sent from my iPad

On Apr 28, 2012, at 8:45 PM, kenk  wrote:

> Hi,
> 
> I've got a server process written in C++ running on Unix machine.
> On the same box I'd like to run multiple Python scripts that will
> communicate with this server.
> 
> Can you please suggest what would be best was to achieve this ?
> 
> Kind regards and thanks in advance!
> M.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-04-28 Thread Roy Smith
In article 
<108cb846-6bb9-4600-a984-2fded0c91...@er9g2000vbb.googlegroups.com>,
 kenk  wrote:

> Hi,
> 
> I've got a server process written in C++ running on Unix machine.
> On the same box I'd like to run multiple Python scripts that will
> communicate with this server.
> 
> Can you please suggest what would be best was to achieve this ?

There are so many reasonable answers, it's hard to know where to start.  
Perhaps if you could give us some clue as to what the server does, it 
might help.

What kind of data are you passing back and forth?  Text?  Binary?  Is it 
important that the communication be as efficient as possible, or is it 
more important that the code be easy to write?  Are you worried about 
security?  Will you ever need to interoperate with other systems written 
in other languages?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Communication between C++ server and Python app

2012-04-28 Thread Chris Angelico
On Sun, Apr 29, 2012 at 10:45 AM, kenk  wrote:
> Hi,
>
> I've got a server process written in C++ running on Unix machine.
> On the same box I'd like to run multiple Python scripts that will
> communicate with this server.
>
> Can you please suggest what would be best was to achieve this ?

Personally, I would recommend a TCP socket, because that allows the
flexibility of splitting across multiple computers. But for
efficiency, you may want to consider a Unix socket too.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Communication between C++ server and Python app

2012-04-28 Thread kenk
Hi,

I've got a server process written in C++ running on Unix machine.
On the same box I'd like to run multiple Python scripts that will
communicate with this server.

Can you please suggest what would be best was to achieve this ?

Kind regards and thanks in advance!
M.
-- 
http://mail.python.org/mailman/listinfo/python-list