thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-1558) Named Pipe and Anonymous Pipe transport for Windows
Date Wed, 11 Apr 2012 22:15:17 GMT

    [ https://issues.apache.org/jira/browse/THRIFT-1558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13251986#comment-13251986
] 

Hudson commented on THRIFT-1558:
--------------------------------

Integrated in Thrift #433 (See [https://builds.apache.org/job/Thrift/433/])
    THRIFT-1558 Named Pipe and Anonymous Pipe transport for Windows
Patch: Peace C (Revision 1325020)

     Result = FAILURE
roger : http://svn.apache.org/viewvc/?view=rev&rev=1325020
Files : 
* /thrift/trunk/lib/cpp/README_WINDOWS
* /thrift/trunk/lib/cpp/libthrift.vcxproj
* /thrift/trunk/lib/cpp/libthrift.vcxproj.filters
* /thrift/trunk/lib/cpp/src/transport/TPipe.cpp
* /thrift/trunk/lib/cpp/src/transport/TPipe.h
* /thrift/trunk/lib/cpp/src/transport/TPipeServer.cpp
* /thrift/trunk/lib/cpp/src/transport/TPipeServer.h
* /thrift/trunk/lib/cpp/src/windows/config.h

                
> Named Pipe and Anonymous Pipe transport for Windows
> ---------------------------------------------------
>
>                 Key: THRIFT-1558
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1558
>             Project: Thrift
>          Issue Type: New Feature
>          Components: C++ - Library
>    Affects Versions: 0.9
>         Environment: Microsoft Windows / Visual Studio
>            Reporter: Peace C
>            Assignee: Peace C
>              Labels: anonymous, named, pipe, thrift, transport
>         Attachments: Pipe_snippets.cpp, Thrift_Named_Pipe_Transport_Windows.patch
>
>
> This patch adds named & anonymous pipe transport for Windows. The new classes do
not affect *NIX builds. We've been using this code on Windows & OSX for 6 months and I'm
fairly confident in it. It has not been hammered by automated tests and I welcome stress testing
to wring out any bugs.
> The TPipe and TPipeServer classes are generally modeled after TSocket and TSocketServer.
The server of course uses TPipeServer to set up the server side then instantiates TPipe for
communications. The client instantiates TPipe transport for connection to the server.
> Here are some code snippet examples from functions we've built. Variables such as 'pipename'
are passed in to the functions. Error handling has been omitted.
> //-----------------------------------------------------------------------
> // ---- Server ----
> //-----------------------------------------------------------------------
> #ifdef _WIN32
> 	pipename = "\\\\.\\pipe\\" + pipename;
> 	boost::shared_ptr<TServerTransport> transport(new TPipeServer(pipename, 1024,
NumThreads)); //Named pipe
> #else  //Mac, *NIX
> 	unlink(pipename.c_str());
> 	boost::shared_ptr<TServerTransport> transport(new TServerSocket(pipename));
> #endif
> 	boost::shared_ptr<TServer> server;
> 	boost::shared_ptr<MyHandler> handler(new MyHandler());
> 	boost::shared_ptr<TProcessor> processor(new MyProcessor(handler));
> 	boost::shared_ptr<TTransportFactory> tfactory(new TBufferedTransportFactory());
> 	boost::shared_ptr<TProtocolFactory> pfactory(new TBinaryProtocolFactory());
> 	if(NumThreads <= 1)
> 	{	//Single-threaded server
> 		server.reset(new TSimpleServer(processor, transport, tfactory, pfactory));
> 	}
> 	else
> 	{	//Multi-threaded server
> 		boost::shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(NumThreads);
> 		boost::shared_ptr<PlatformThreadFactory> threadFactory = boost::shared_ptr<PlatformThreadFactory>(new
PlatformThreadFactory());
> 		threadManager->threadFactory(threadFactory);
> 		threadManager->start();
> 		server.reset(new TThreadPoolServer(processor, transport, tfactory, pfactory, threadManager));
> 	}
> 	printf("Starting the 'server'...\n");
> 	server->serve();
> 	printf("done.\n");
> //-----------------------------------------------------------------------
> // ---- Client ----
> //-----------------------------------------------------------------------
> #ifdef _WIN32
> 	pipename = "\\\\.\\pipe\\" + pipename;
> 	boost::shared_ptr<TTransport> pipe(new TPipe(pipename));
> 	transport.reset(new TBufferedTransport(pipe));
> #else  //Mac, *nix
> 	boost::shared_ptr<TTransport> socket(new TSocket(pipename));
> 	transport.reset(new TBufferedTransport(socket));
> #endif
> 	boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
> 	client.reset(new MyClient(protocol));

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message