Hi Bård,

In case it helps, here are some some lines of code where I instantiate a
TSocketServer for a random app.  Just for clarity I also pasted the lines
from the service declaration in the .thrift file that get compiled into the
class called 'VideoSubscriptionProcessor' used below.

Regards,

Paul



*service declaration from .thrift file*


service VideoSubscription {
      Ack receiveVideo(1: required VideoSubscriptionMessage message) throws
(1: GenericException e);
}




*cocoa TSocketServer instantiation
*


VideoSubscriptionProcessor *videoProcessor = [[VideoSubscriptionProcessor
alloc] initWithVideoSubscription:self];  // 'self' is object that
implements VideoSubscription protocol

TSharedProcessorFactory *processorFactory =
[[TSharedProcessorFactory alloc] initWithSharedProcessor:videoProcessor];

TSocketServer *socketServer =
[[TSocketServer alloc] initWithPort:9095
protocolFactory:[TBinaryProtocolFactory sharedFactory]
processorFactory:processorFactory];



On Tue, Jan 31, 2012 at 2:11 PM, Jools Enticknap <[email protected]> wrote:

> Hi Bård,
>
> The cocoa generator does create all the supporting code you need to create
> a cocoa based service.
>
> In order to create an endpoint which will handle the socket connections,
> take a look at the the TSocketServer.[hm] files.
>
> The generated file will provide you with an implementation of a TProcessor
> which will manage interaction with your service.
>
> so….
>
> If you have a service called Foo, then you will find in the generated .h
> file a @protocol Foo, which will have all the methods you need to implement
> to handle the service requests.
>
> Once you have implemented your Foo class, you can pass that to your
> FooProcessor, which in tern can be used in conjunction with the
> TSocketServer.
>
> Hope that helps.
>
> --
> Jools Enticknap
>
>
> On Tuesday, 31 January 2012 at 10:12, Bård Fjukstad wrote:
>
> > Are there any examples of a thrift server using cococa? The generator
> does not create any server skeletons, like the cpp generator. I have
> searched for examples all over the net, but found none.
> >
> > Basically I am trying to set up a server in an iPhone.
> >
> > The client side on the iPhone, on the other hand, works very well.
> >
> > regards
> >
> > Bård.
>
>

Reply via email to