Пример #1
0
 public clientConnection(Socket s, serverTCP sv)
 {
     svr   = sv;
     cSock = s;
     ThreadPool.QueueUserWorkItem(new WaitCallback(handleConnection));
     sendipaddress();
 }
Пример #2
0
        private static void doCMD(string p)
        {
            serverTCP TCP = new serverTCP();

            switch (p)
            {
            case "exit":
                keepAlive = false;
                break;

            case "tdb":
                output.outToScreen("The database is " + (database.isDatabaseRead() ? "available." : "not available."));
                break;

            case "test":
                TCP.send();
                break;

            case "showclientsinfo":
                TCP.show_clientsinfo();
                break;

            case "initializeclientsinfo":
                TCP.initialize_clientsinfo();
                break;

            case "disconnect":
                TCP.Disconnect();
                break;

            default:
                output.outToScreen("There are no commands named " + p);
                break;
            }
        }
Пример #3
0
        static void Main()
        {
            // start server
            serverTCP startTCP = new serverTCP();

            // keep alive
            while (keepAlive)
            {
                doCMD(Console.ReadLine().ToLower());
            }
        }
Пример #4
0
        public void sendipaddress()
        {
            sendip = cSock.RemoteEndPoint.ToString();
            message  newMessage1000 = new message("SendipaddressResponse");
            scObject data           = new scObject("data");

            data.addBool("response", true);
            data.addString("useripaddress", sendip);
            newMessage1000.addSCObject(data);
            serverTCP power = new serverTCP();

            power.sendClientMessage(cSock, newMessage1000);
        }