summaryrefslogtreecommitdiffstats
path: root/vstf/vstf/common/unix.py
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2016-03-25 03:55:53 -0400
committerMatthewLi <matthew.lijun@huawei.com>2016-03-25 03:55:53 -0400
commitf84c8dcc22f1499128893e62b0e15b4b592c47ba (patch)
treeee14029aa59c076fdfde1c504a385f3389477a6a /vstf/vstf/common/unix.py
parent7ba76747d55669e2bbaf70a3061e1c0b5dea912e (diff)
adjust project directories
JIRA: BOTTLENECK-56 Change-Id: Ic9acad5eaa4917093bdb85a80960f796f5b4ba7f Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
Diffstat (limited to 'vstf/vstf/common/unix.py')
-rw-r--r--vstf/vstf/common/unix.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/vstf/vstf/common/unix.py b/vstf/vstf/common/unix.py
deleted file mode 100644
index 97582c74..00000000
--- a/vstf/vstf/common/unix.py
+++ /dev/null
@@ -1,62 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import os
-import socket
-from vstf.common import constants
-from vstf.common import message
-
-
-class UdpServer(object):
- def __init__(self):
- super(UdpServer, self).__init__()
- try:
- os.unlink(constants.sockaddr)
- except OSError:
- if os.path.exists(constants.sockaddr):
- raise Exception("socket not found %s" % constants.sockaddr)
- self.conn=socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-
- def listen(self,backlog=5):
- self.conn.listen(backlog)
-
- def accept(self):
- return self.conn.accept()
-
- def bind(self, addr=constants.sockaddr):
- return self.conn.bind(addr)
-
-# def send(self, data, addr):
-# return message.sendto(self.conn.sendto, data, addr)
-
-# def recv(self, size=constants.buff_size):
-# return message.recv(self.conn.recvfrom)
-
- def close(self):
- self.conn.close()
-
-
-class UdpClient(object):
- def __init__(self):
- super(UdpClient, self).__init__()
- if not os.path.exists(constants.sockaddr):
- raise Exception("socket not found %s" % constants.sockaddr)
- self.conn=socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-
- def connect(self, addr=constants.sockaddr):
- return self.conn.connect(addr)
-
- def send(self, data):
- message.send(self.conn.send, data)
-
- def recv(self):
- return message.recv(self.conn.recv)
-
- def close(self):
- self.conn.close() \ No newline at end of file