Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using namespace std;
using boost::shared_ptr;
//using boost::shared_ptr;

using namespace ::myrpc::thrift;

int main(){
boost::shared_ptr<TSocket> socket(new TSocket("localhost", 9090));
boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
std::shared_ptr<TSocket> socket(new TSocket("localhost", 9090));
std::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
std::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));

HeapSortClient client(protocol);
transport->open();
Expand Down
12 changes: 6 additions & 6 deletions server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;

using boost::shared_ptr;
//using boost::shared_ptr;
using namespace ::myrpc::thrift;

class HeapSortHandler : virtual public HeapSortIf {
Expand Down Expand Up @@ -68,11 +68,11 @@ class HeapSortHandler : virtual public HeapSortIf {

int main(int argc, char **argv) {
int port = 9090;
shared_ptr<HeapSortHandler> handler(new HeapSortHandler());
shared_ptr<TProcessor> processor(new HeapSortProcessor(handler));
shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
std::shared_ptr<HeapSortHandler> handler(new HeapSortHandler());
std::shared_ptr<TProcessor> processor(new HeapSortProcessor(handler));
std::shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
std::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
std::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());

TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
server.serve();
Expand Down