aboutsummaryrefslogtreecommitdiffstats
path: root/termcast_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'termcast_client.py')
-rw-r--r--termcast_client.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/termcast_client.py b/termcast_client.py
new file mode 100644
index 0000000..22941f8
--- /dev/null
+++ b/termcast_client.py
@@ -0,0 +1,27 @@
+import os
+import pty
+import socket
+import sys
+
+class Client(object):
+ def __init__(self):
+ pass
+
+ def run(self, argv):
+ sock = socket.socket()
+ sock.connect(("tozt.net", 2201))
+ sock.send(b'hello doy asdf\n\033]499;{"geometry":[80,24]}\007')
+ pty.spawn(argv, lambda fd: self._master_read(fd, sock))
+
+ def _master_read(self, fd, sock):
+ data = os.read(fd, 1024)
+ sock.send(data)
+ return data
+
+if __name__ == '__main__':
+ client = Client()
+ # XXX options
+ if len(sys.argv) > 1:
+ client.run(sys.argv[1:])
+ else:
+ client.run(os.getenv("SHELL", default="/bin/sh"))