You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Deeraj <de...@tataelxsi.co.in> on 2015/04/08 15:45:02 UTC

Server skeleton generation using c_glib

*Hi,

I am trying to implement client/ server in c. I am able to generate the 
server skeleton in cpp using the following command :

         thrift ---gen cpp test.thrift

But while generating the code using c_glib, the server skeleton is not 
generated.

Is this a problem with my .thrift file or is it because of the c_glib ?
Can you kindly confirm whether the c_glib generates the server skeleton?

The test.thrift file am using is appended here :

*

|#!/usr/local/bin/thrift --gen c_glib

namespace  c_glibTest

struct  packet{
   1:required i32 header,
   2:required i32 data,
   3:required i32 crc
}

serviceSomething  {
   i32 ping(),
   packet transfer()
}|




Re: Server skeleton generation using c_glib

Posted by Deeraj <de...@tataelxsi.co.in>.
Thanks for the response. In that case, can you tell me how we can 
implement the server code.

On 4/9/2015 5:23 AM, Randy Abernethy wrote:
> Hello,
>
> Most languages do not generate a server skeleton, c++ is one of the few
> that does.
>
> -Randy
>
> On Wednesday, April 8, 2015, Deeraj <de...@tataelxsi.co.in> wrote:
>
>> *Hi,
>>
>> I am trying to implement client/ server in c. I am able to generate the
>> server skeleton in cpp using the following command :
>>
>>          thrift ---gen cpp test.thrift
>>
>> But while generating the code using c_glib, the server skeleton is not
>> generated.
>>
>> Is this a problem with my .thrift file or is it because of the c_glib ?
>> Can you kindly confirm whether the c_glib generates the server skeleton?
>>
>> The test.thrift file am using is appended here :
>>
>> *
>>
>> |#!/usr/local/bin/thrift --gen c_glib
>>
>> namespace  c_glibTest
>>
>> struct  packet{
>>    1:required i32 header,
>>    2:required i32 data,
>>    3:required i32 crc
>> }
>>
>> serviceSomething  {
>>    i32 ping(),
>>    packet transfer()
>> }|
>>
>>
>>
>>

-- 
Thanks & Regards,
Deeraj Soman
Senior Engineer - TBU | Embedded Product Design
TATA ELXSI
Technopark CampusKariyavattomTrivandrum 695 581India
Phone:+91 471 666 1124
Mobile: +91 9895703852
*www.tataelxsi.com* 
<https://sinprd0410.outlook.com/owa/redir.aspx?C=qyQ5HANN90SvDNp5pyzlQgCjW3rPss8IRh9kaHIpdT-pocCvJc2bGjG5OjXXp8HUHmQTB2YZ2Kw.&URL=http%3a%2f%2fwww.tataelxsi.com%2f>



Re: Server skeleton generation using c_glib

Posted by Randy Abernethy <ra...@gmail.com>.
Hello,

Most languages do not generate a server skeleton, c++ is one of the few
that does.

-Randy

On Wednesday, April 8, 2015, Deeraj <de...@tataelxsi.co.in> wrote:

>
> *Hi,
>
> I am trying to implement client/ server in c. I am able to generate the
> server skeleton in cpp using the following command :
>
>         thrift ---gen cpp test.thrift
>
> But while generating the code using c_glib, the server skeleton is not
> generated.
>
> Is this a problem with my .thrift file or is it because of the c_glib ?
> Can you kindly confirm whether the c_glib generates the server skeleton?
>
> The test.thrift file am using is appended here :
>
> *
>
> |#!/usr/local/bin/thrift --gen c_glib
>
> namespace  c_glibTest
>
> struct  packet{
>   1:required i32 header,
>   2:required i32 data,
>   3:required i32 crc
> }
>
> serviceSomething  {
>   i32 ping(),
>   packet transfer()
> }|
>
>
>
>

Re: Server skeleton generation using c_glib

Posted by Deeraj <de...@tataelxsi.co.in>.
Hi,

As per the suggestion given yesterday, I have implemented a server code. 
I hope the same will work.
The issue now am facing is that am not able to compile and build the 
code successfully.

The thrift (calc.thrift) file am using is as follows :

*#!/usr/local/bin/thrift --gen c_glib


service Calculator {
         void ping(),
         i32 calculate(1:i32 id, 2:i32 num)
}*

The Makefile am using is

*GEN_SRC := Calc_server.c calculator.c calc_types.c
GEN_OBJ := $(patsubst %.c,%.o, $(GEN_SRC))

GLIB_OBJ_DIR := /usr/include/glib-2.0
GLIB_CFG_DIR := /usr/lib/x86_64-linux-gnu/glib-2.0/include
THRIFT_DIR := /usr/local/include/thrift
BOOST_DIR := /usr/local/include

INC := -I$(THRIFT_DIR) -I$(BOOST_DIR) -I$(GLIB_OBJ_DIR) -I$(GLIB_CFG_DIR)

.PHONY: all clean

all: calc_server

%.o: %.c
         $(CXX) -Wall -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H $(INC) -c $< 
-o $@

calc_server: calc_types.o calculator.o Calc_server.o $(GEN_OBJ)
         $(CXX) $^ -o $@ -lthrift

clean:
         $(RM) *.o calc_server*

With minor changes in the above Makefile am able to generate the 
executable for the cpp counterpart.
Why is it that am not able to do the same for c?
Is it the problem of Makefile?

Kindly assist me so that I can generate the server executable.


On 4/9/2015 9:32 AM, Deeraj wrote:
> Thanks JensG. So I suppose, I will need to go through the tutorial to 
> get going.
>
> On 4/9/2015 5:18 AM, Jens Geyer wrote:
>> Hi Deeraj,
>>
>> the answer on that question you already received on SO [1] is 
>> entirely sufficient. There's nothing more to add (at least from my 
>> perspective), except maybe that only a handful of languages implement 
>> skeleton generation or something comparable at all  - and we are 
>> talking about very small hands here :-) As Simon already wrote over 
>> there, the skeleton code is not really needed in most cases. I would 
>> add, that that code depends to a good part on the requirements. The 
>> tutorial and the Thrift test implementations are really good examples 
>> to get started.
>>
>> Have fun using Thrift,
>> JensG
>>
>> [1]
>> http://stackoverflow.com/questions/29506326/server-skeleton-not-generating-in-c-glib-thrift 
>>
>>
>>
>>
>> -----Ursprüngliche Nachricht----- From: Deeraj
>> Sent: Wednesday, April 8, 2015 3:45 PM
>> To: user@thrift.apache.org
>> Subject: Server skeleton generation using c_glib
>>
>>
>> *Hi,
>>
>> I am trying to implement client/ server in c. I am able to generate the
>> server skeleton in cpp using the following command :
>>
>>         thrift ---gen cpp test.thrift
>>
>> But while generating the code using c_glib, the server skeleton is not
>> generated.
>>
>> Is this a problem with my .thrift file or is it because of the c_glib ?
>> Can you kindly confirm whether the c_glib generates the server skeleton?
>>
>> The test.thrift file am using is appended here :
>>
>> *
>>
>> |#!/usr/local/bin/thrift --gen c_glib
>>
>> namespace  c_glibTest
>>
>> struct  packet{
>>   1:required i32 header,
>>   2:required i32 data,
>>   3:required i32 crc
>> }
>>
>> serviceSomething  {
>>   i32 ping(),
>>   packet transfer()
>> }|
>>
>>
>>
>> .
>>
>

-- 
Thanks & Regards,
Deeraj Soman
Senior Engineer - TBU | Embedded Product Design
TATA ELXSI
Technopark CampusKariyavattomTrivandrum 695 581India
Phone:+91 471 666 1124
Mobile: +91 9895703852
*www.tataelxsi.com* 
<https://sinprd0410.outlook.com/owa/redir.aspx?C=qyQ5HANN90SvDNp5pyzlQgCjW3rPss8IRh9kaHIpdT-pocCvJc2bGjG5OjXXp8HUHmQTB2YZ2Kw.&URL=http%3a%2f%2fwww.tataelxsi.com%2f>



Re: Server skeleton generation using c_glib

Posted by Deeraj <de...@tataelxsi.co.in>.
Thanks JensG. So I suppose, I will need to go through the tutorial to 
get going.

On 4/9/2015 5:18 AM, Jens Geyer wrote:
> Hi Deeraj,
>
> the answer on that question you already received on SO [1] is entirely 
> sufficient. There's nothing more to add (at least from my 
> perspective), except maybe that only a handful of languages implement 
> skeleton generation or something comparable at all  - and we are 
> talking about very small hands here :-) As Simon already wrote over 
> there, the skeleton code is not really needed in most cases. I would 
> add, that that code depends to a good part on the requirements. The 
> tutorial and the Thrift test implementations are really good examples 
> to get started.
>
> Have fun using Thrift,
> JensG
>
> [1]
> http://stackoverflow.com/questions/29506326/server-skeleton-not-generating-in-c-glib-thrift 
>
>
>
>
> -----Ursprüngliche Nachricht----- From: Deeraj
> Sent: Wednesday, April 8, 2015 3:45 PM
> To: user@thrift.apache.org
> Subject: Server skeleton generation using c_glib
>
>
> *Hi,
>
> I am trying to implement client/ server in c. I am able to generate the
> server skeleton in cpp using the following command :
>
>         thrift ---gen cpp test.thrift
>
> But while generating the code using c_glib, the server skeleton is not
> generated.
>
> Is this a problem with my .thrift file or is it because of the c_glib ?
> Can you kindly confirm whether the c_glib generates the server skeleton?
>
> The test.thrift file am using is appended here :
>
> *
>
> |#!/usr/local/bin/thrift --gen c_glib
>
> namespace  c_glibTest
>
> struct  packet{
>   1:required i32 header,
>   2:required i32 data,
>   3:required i32 crc
> }
>
> serviceSomething  {
>   i32 ping(),
>   packet transfer()
> }|
>
>
>
> .
>

-- 
Thanks & Regards,
Deeraj Soman
Senior Engineer - TBU | Embedded Product Design
TATA ELXSI
Technopark CampusKariyavattomTrivandrum 695 581India
Phone:+91 471 666 1124
Mobile: +91 9895703852
*www.tataelxsi.com* 
<https://sinprd0410.outlook.com/owa/redir.aspx?C=qyQ5HANN90SvDNp5pyzlQgCjW3rPss8IRh9kaHIpdT-pocCvJc2bGjG5OjXXp8HUHmQTB2YZ2Kw.&URL=http%3a%2f%2fwww.tataelxsi.com%2f>



Re: Server skeleton generation using c_glib

Posted by Jens Geyer <je...@hotmail.com>.
Hi Deeraj,

the answer on that question you already received on SO [1] is entirely 
sufficient. There's nothing more to add (at least from my perspective), 
except maybe that only a handful of languages implement skeleton generation 
or something comparable at all  - and we are talking about very small hands 
here :-) As Simon already wrote over there, the skeleton code is not really 
needed in most cases. I would add, that that code depends to a good part on 
the requirements. The tutorial and the Thrift test implementations are 
really good examples to get started.

Have fun using Thrift,
JensG

[1]
http://stackoverflow.com/questions/29506326/server-skeleton-not-generating-in-c-glib-thrift



-----Ursprüngliche Nachricht----- 
From: Deeraj
Sent: Wednesday, April 8, 2015 3:45 PM
To: user@thrift.apache.org
Subject: Server skeleton generation using c_glib


*Hi,

I am trying to implement client/ server in c. I am able to generate the
server skeleton in cpp using the following command :

         thrift ---gen cpp test.thrift

But while generating the code using c_glib, the server skeleton is not
generated.

Is this a problem with my .thrift file or is it because of the c_glib ?
Can you kindly confirm whether the c_glib generates the server skeleton?

The test.thrift file am using is appended here :

*

|#!/usr/local/bin/thrift --gen c_glib

namespace  c_glibTest

struct  packet{
   1:required i32 header,
   2:required i32 data,
   3:required i32 crc
}

serviceSomething  {
   i32 ping(),
   packet transfer()
}|