Skip to content

Commit ab849f2

Browse files
committedDec 25, 2013
Default Port
If port argument is given, use that port. If not, use 8080.
1 parent 84ec6a9 commit ab849f2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

‎proxy.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
BACKLOG = 50 # how many pending connections queue will hold
1313
MAX_DATA_RECV = 999999 # max number of bytes we receive at once
1414
DEBUG = True # set to True to see the debug msgs
15-
BLOCKED = [] # just an example. Remove with [""] for no blocking at all.
15+
BLOCKED = [] # just an example. Remove with [""] for no blocking at all.
1616

1717
#**************************************
1818
#********* MAIN PROGRAM ***************
@@ -21,14 +21,15 @@ def main():
2121

2222
# check the length of command running
2323
if (len(sys.argv)<2):
24-
print "usage: proxy <port>"
25-
return sys.stdout
24+
print "No port given, using :8080 (http-alt)"
25+
port = 8080
26+
else:
27+
port = int(sys.argv[1]) # port from argument
2628

2729
# host and port info.
2830
host = '' # blank for localhost
29-
port = int(sys.argv[1]) # port from argument
3031

31-
print "Proxy Server Running on ",host,":",sys.argv[1]
32+
print "Proxy Server Running on ",host,":",port
3233

3334
try:
3435
# create a socket

0 commit comments

Comments
 (0)