--- /dev/null
+
+Comunicare Client <-> Server
+
+1. Step 1
+ - informatiile legate de clienti
+ - msg 1: tipul mesajului: CONFIG_MSG (definit in Util.py)
+ - msg 2: lista de dictionare cu datele din clients.xml
+ exp: [{CLIENT:"tribler", FILE:"Tribler/Tools/cmdline.py",
+ RUN_TYPE:"script",
+ INTERPRETER:"python", PREFIX:"PYTHONPATH=.",SUFFIX:"",
+ UP_LIMIT_OPTION:"",DL_LIMIT_OPTION:"", PORT_OPTION:"-p",
+ LOG_DIR_OPTION:"-l",DL_DIR_OPTION:"-d"}]
+
+2. Mesaje START
+
+.....
--- /dev/null
+
+#!/usr/bin/env python
+
+""" Message types: client -> server """
+
+CONFIG_MSG = "0";
+START_MSG = "1";
+STOP_MSG = "2";
+STATUS_MSG = "3";
+
+
+# xml tags from clients.xml
+CLIENT = "client"
+FILE = "file"
+RUN_TYPE = "run type"
+INTERPRETER = "interpreter"
+PREFIX = "prefix"
+SUFFIX = "suffix"
+UP_LIMIT_OPTION = "upload_limit_option"
+DL_LIMIT_OPTION = "download_limit_option"
+PORT_OPTION = "port_option"
+LOG_DIR_OPTION = "logging_dir_option"
+DL_DIR_OPTION = "download_dir_option"
--- /dev/null
+
+Comunicare Client <-> Server
+
+1. Step 1
+ - informatiile legate de clienti
+ - msg 1: tipul mesajului: CONFIG_MSG (definit in Util.py)
+ - msg 2: lista de dictionare cu datele din clients.xml
+ exp: [{CLIENT:"tribler", FILE:"Tribler/Tools/cmdline.py",
+ RUN_TYPE:"script",
+ INTERPRETER:"python", PREFIX:"PYTHONPATH=.",SUFFIX:"",
+ UP_LIMIT_OPTION:"",DL_LIMIT_OPTION:"", PORT_OPTION:"-p",
+ LOG_DIR_OPTION:"-l",DL_DIR_OPTION:"-d"}]
+
+2. Mesaje START
+
+.....
WAITING_STOP_DATA = 4
WAITING_STATUS_DATA = 5
+clients_data = []
+
def recv_pickled_data(clientsock):
# while chunk:
while(1):
(clientsock, address) = serversocket.accept();
-
- """ draft
+ """ DRAFT
if clientsock not in states:
states[clientsock] = WAITING_MSG_TYPE;
states[clientsock] = WAITING_CONFIG_DATA;
else if msg == Util.START_MSG:
- states[clientsock] = WAITING_CONFIG_DATA;
+ states[clientsock] = WAITING_START_DATA;
else if msg == Util.STOP_MSG:
- states[clientsock] = WAITING_CONFIG_DATA;
+ states[clientsock] = WAITING_STOP_DATA;
else if msg == Util.STATUS_MSG:
- states[clientsock] = WAITING_CONFIG_DATA;
+ states[clientsock] = WAITING_STATUS_DATA;
else
clientsock.send("error: wrong message type " + msg)
else:
if states[clientsock] == WAITING_CONFIG_DATA:
- config = recv_pickled_data(clientsock)
+ config_data = recv_pickled_data(clientsock)
+ if states[clientsock] == WAITING_START_DATA:
+ config = recv_pickled_data(clientsock)
+ if states[clientsock] == WAITING_STOP_DATA:
+ config = recv_pickled_data(clientsock)
+
+ if states[clientsock] == WAITING_STATUS_DATA:
+ config = recv_pickled_data(clientsock)
+
states[clientsock] = WAITING_MSG_TYPE
"""
-
- #clientsock.recv(BUFFER_SIZE)
- recv_pickled_data(clientsock)
+ # clientsock.recv(BUFFER_SIZE)
+ # recv_pickled_data(clientsock)
clientsock.send("ACK")
clientsock.close()
--- /dev/null
+
+#!/usr/bin/env python
+
+""" Message types: client -> server """
+
+CONFIG_MSG = "0";
+START_MSG = "1";
+STOP_MSG = "2";
+STATUS_MSG = "3";
+
+
+# xml tags from clients.xml
+CLIENT = "client"
+FILE = "file"
+RUN_TYPE = "run type"
+INTERPRETER = "interpreter"
+PREFIX = "prefix"
+SUFFIX = "suffix"
+UP_LIMIT_OPTION = "upload_limit_option"
+DL_LIMIT_OPTION = "download_limit_option"
+PORT_OPTION = "port_option"
+LOG_DIR_OPTION = "logging_dir_option"
+DL_DIR_OPTION = "download_dir_option"
+++ /dev/null
-
-#!/usr/bin/env python
-
-""" Message types: client -> server """
-
-CONFIGURE_MSG = "0";
-START_MSG = "1";
-STOP_MSG = "2";
-STATUS_MSG = "3";
-
-
-