Commit 1a770a36 authored by Cyril Guilloud's avatar Cyril Guilloud Committed by Cyril Guilloud

tcp / udp __info__()

parent 2d2e226f
......@@ -327,6 +327,10 @@ class BaseSocket:
class Socket(BaseSocket):
def __info__(self):
info_str = f"TCP SOCKET: host={self._host} port={self._port} \n"
return info_str
def _connect(self, host, port):
fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
fd.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
......@@ -471,6 +475,10 @@ class Command:
def __str__(self):
return f"{self.__class__.__name__}[{self._host}:{self._port}]"
def __info__(self):
info_str = "TCP COMMAND: host={self._host} port={self._port} \n"
return info_str
@property
def lock(self):
return self._lock
......
......@@ -17,6 +17,10 @@ from bliss.common.logtools import *
class Socket(BaseSocket):
def __info__(self):
info_str = "UDP SOCKET: host={self._host} port={self._port} \n"
return info_str
def _connect(self, host, port):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_IP, socket.IP_TOS, 0x10)
......
......@@ -208,7 +208,9 @@ Mainly for tests and debugging purpose.
#### Not declared in config
Example to use in BLISS shell.
```yaml
```python
from bliss.comm.util import get_comm, TCP
conf = {"tcp": {"url": "trucmuch.esrf.fr"}}
opt = {"port":5025}
kom = get_comm(conf, ctype=TCP, **opt)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment