# Path: linux_story/MyTCPHandler.py
# class MyTCPHandler(SocketServer.BaseRequestHandler):
#     """
#     The RequestHandler class for our server.
# 
#     It is instantiated once per connection to the server, and must
#     override the handle() method to implement communication to the
#     client.
#     """
# 
#     def __init__(self, arg1, arg2, arg3):
#         self.continue_server = True
#         SocketServer.BaseRequestHandler.__init__(self, arg1, arg2, arg3)
# 
#     def handle(self):
# 
#         # self.request is the TCP socket connected to the client
#         data = self.request.recv(4096).strip()
#         self.server.queue.put(json.loads(data))


import socket
import threading
import Queue
import SocketServer
import time
import traceback
from linux_story.MyTCPHandler import MyTCPHandler
from kano.logging import logger
# MessageServer.py
#
# Copyright (C) 2014-2016 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# Controls communicating between the GUI and the terminal



class MessageServer:
    HOST = "localhost"
    PORT = 9959

    def __init__(self, queue, window):
        self.__window = window
        self.__server_busy = False
        SocketServer.TCPServer.allow_reuse_address = True

# Path: linux_story/MyTCPHandler.py
# class MyTCPHandler(SocketServer.BaseRequestHandler):
#     """
#     The RequestHandler class for our server.
# 
#     It is instantiated once per connection to the server, and must
#     override the handle() method to implement communication to the
#     client.
#     """
# 
#     def __init__(self, arg1, arg2, arg3):
#         self.continue_server = True
#         SocketServer.BaseRequestHandler.__init__(self, arg1, arg2, arg3)
# 
#     def handle(self):
# 
#         # self.request is the TCP socket connected to the client
#         data = self.request.recv(4096).strip()
#         self.server.queue.put(json.loads(data))


# Path: linux_story/MessageServer.py
import socket
import threading
import Queue
import SocketServer
import time
import traceback
from linux_story.MyTCPHandler import MyTCPHandler
from kano.logging import logger

# MessageServer.py
#
# Copyright (C) 2014-2016 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# Controls communicating between the GUI and the terminal



class MessageServer:
    HOST = "localhost"
    PORT = 9959

    def __init__(self, queue, window):
        self.__window = window
        self.__server_busy = False
        SocketServer.TCPServer.allow_reuse_address = True

        self.__server = SocketServer.TCPServer((MessageServer.HOST, MessageServer.PORT), MyTCPHandler)