Archive of UserLand's first discussion group, started October 5, 1998.

CORBA Random Number Server in Python

Author:michael j lawley
Posted:7/13/1999; 7:33:54 AM
Topic:Today's scriptingNews Outline
Msg #:8442 (In response to 8440)
Prev/Next:8441 / 8443

It took me about the same amount of time to implement a server in Python using Fnorb having never done this before (although I have done C++ & Java CORBA work). Half the time involved looking up the Python library reference to determine how to generate the appropriate random numbers.

With the right tools, CORBA needn't be hard either.

Code follows (there's some extra needed to set the server going, but it's essentially boilerplate stuff):

# Standard/built-in modules.
import sys, random

# Fnorb modules. from Fnorb.orb import BOA, CORBA

# Stubs and skeletons generated by 'fnidl'. import Random_skel

class RandomImpl(Random_skel.Random_skel): """ Implementation of the Random interface """

def __init__(self):

# Base class constructor. CORBA.Object_skel.__init__(self)

return

def lrand48(self): return random.randint(0, (2 ** 31) - 1)

def mrand48(self, added, removed): return random.randint(-(2 ** 31), (2 ** 31) - 1)




There are responses to this message:


This page was archived on 6/13/2001; 4:51:23 PM.

© Copyright 1998-2001 UserLand Software, Inc.