示例#1
0
 private void CleanUp()
 {
     if (server != null)
         server.StopServer();
     if (user != null)
         user.Disconnect();
     server = null;
     user = null;
 }
示例#2
0
文件: Server.cs 项目: fnasim/VTC
 public Client(Socket c, Server s)
 {
     connectionID++;
         this.sock = c;
         this.server = s;
         stream = new NetworkStream(sock);
         callbackRead = new AsyncCallback(this.OnReadComplete);
         callbackWrite = new AsyncCallback(this.OnWriteComplete);
         buffer = new byte[256];
         writebuffer = new byte[256];
         user = new User();
         channel = new Channel();
 }
示例#3
0
        private void StartServer()
        {
            LoggerCallback logger = new LoggerCallback (this.UpdateLogThreaded);
            try
            {
                server = new Server(int.Parse(txtServerPort.Text));
                user = new UserBase();
                //server.BindSigninNotify(new GenericCallback(this.UpdateSignin));
                //server.BindSignoutNotify(new GenericCallback(this.UpdateSignout));

                server.BindUserBase(user);
                server.BindDebugObject(logger);
                user.BindDebugObject(logger);

                server.StartServer();
                user.Connect();
            }
            catch (Exception ex)
            {
                UpdateLog("Port address is incorrect or already in use. " + ex.Message);
            }
        }
示例#4
0
文件: Channel.cs 项目: fnasim/VTC
 public Channel(long id, Server.Client client)
 {
     ChannelID = id;
     ChannelClient = client;
     ChannelOwner = ChannelClient.user;
 }