1 #!/usr/bin/env python2.7
2 # Copyright 2015 gRPC authors.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 """Opens a TCP connection to a specified server and then exits."""
25 argp = argparse.ArgumentParser(
26 description='Open a TCP handshake to a server')
27 argp.add_argument('-s',
31 help='Server host name or IP.')
32 argp.add_argument('-p',
36 help='Port that the server is listening on.')
37 argp.add_argument('-t',
41 help='Force process exit after this number of seconds.')
42 args = argp.parse_args()
43 socket.create_connection([args.server_host, args.server_port],
47 if __name__ == '__main__':