Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
30 ashish 1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one
3
 * or more contributor license agreements. See the NOTICE file
4
 * distributed with this work for additional information
5
 * regarding copyright ownership. The ASF licenses this file
6
 * to you under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in compliance
8
 * with the License. You may obtain a copy of the License at
9
 *
10
 *   http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing,
13
 * software distributed under the License is distributed on an
14
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 * KIND, either express or implied. See the License for the
16
 * specific language governing permissions and limitations
17
 * under the License.
18
 */
19
 
20
#ifndef _THRIFT_TRANSPORT_TSERVERSOCKET_H_
21
#define _THRIFT_TRANSPORT_TSERVERSOCKET_H_ 1
22
 
23
#include "TServerTransport.h"
24
#include <boost/shared_ptr.hpp>
25
 
26
namespace apache { namespace thrift { namespace transport {
27
 
28
class TSocket;
29
 
30
/**
31
 * Server socket implementation of TServerTransport. Wrapper around a unix
32
 * socket listen and accept calls.
33
 *
34
 */
35
class TServerSocket : public TServerTransport {
36
 public:
37
  TServerSocket(int port);
38
  TServerSocket(int port, int sendTimeout, int recvTimeout);
39
 
40
  ~TServerSocket();
41
 
42
  void setSendTimeout(int sendTimeout);
43
  void setRecvTimeout(int recvTimeout);
44
 
45
  void setRetryLimit(int retryLimit);
46
  void setRetryDelay(int retryDelay);
47
 
48
  void setTcpSendBuffer(int tcpSendBuffer);
49
  void setTcpRecvBuffer(int tcpRecvBuffer);
50
 
51
  void listen();
52
  void close();
53
 
54
  void interrupt();
55
 
56
 protected:
57
  boost::shared_ptr<TTransport> acceptImpl();
58
 
59
 private:
60
  int port_;
61
  int serverSocket_;
62
  int acceptBacklog_;
63
  int sendTimeout_;
64
  int recvTimeout_;
65
  int retryLimit_;
66
  int retryDelay_;
67
  int tcpSendBuffer_;
68
  int tcpRecvBuffer_;
69
 
70
  int intSock1_;
71
  int intSock2_;
72
};
73
 
74
}}} // apache::thrift::transport
75
 
76
#endif // #ifndef _THRIFT_TRANSPORT_TSERVERSOCKET_H_