Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'python/src/tcf/channel/ChannelTCP.py')
-rw-r--r--python/src/tcf/channel/ChannelTCP.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/python/src/tcf/channel/ChannelTCP.py b/python/src/tcf/channel/ChannelTCP.py
index ae020237b..7126e9554 100644
--- a/python/src/tcf/channel/ChannelTCP.py
+++ b/python/src/tcf/channel/ChannelTCP.py
@@ -23,12 +23,15 @@ class ChannelTCP(StreamChannel):
channel = self
class CreateSocket(object):
def __call__(self):
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.connect((host, port))
- sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1)
- sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
- channel.socket = sock
- channel._onSocketConnected(None)
+ try:
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sock.connect((host, port))
+ sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1)
+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
+ channel.socket = sock
+ channel._onSocketConnected(None)
+ except Exception as x:
+ channel._onSocketConnected(x)
protocol.invokeLater(CreateSocket())
def _onSocketConnected(self, x):

Back to the top