Guest User

Server

a guest
Apr 30th, 2017
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.57 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Remoting;
  5. using System.Runtime.Remoting.Channels;
  6. using System.Runtime.Remoting.Channels.Tcp;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9.  
  10.  
  11.  
  12. class EvaluatorServer
  13. {
  14.     static void Main(string[] args)
  15.     {
  16.         EvaluatorPlatform();
  17.     }
  18.  
  19.     static void EvaluatorPlatform()
  20.     {
  21.         TcpChannel tcpChannel = new TcpChannel(9998);
  22.         ChannelServices.RegisterChannel(tcpChannel, true);
  23.         Type commonInterfaceType = Type.GetType("Driving");
  24.         RemotingConfiguration.RegisterWellKnownServiceType(commonInterfaceType, "DrivingLesson", WellKnownObjectMode.SingleCall);
  25.  
  26.         System.Console.WriteLine("Press Enter to Quit");
  27.         System.Console.ReadLine();
  28.     }
  29. }
  30.  
  31.     public interface gradeCalculate
  32.     {
  33.         //void Start();
  34.         bool authenticate(string username, string password);
  35.     }
  36.  
  37.     public class Driving : MarshalByRefObject, gradeCalculate
  38.     {
  39.         string serverUsername, serverPassword ;
  40.         bool authenticated;
  41.  
  42.    
  43.  
  44.     //public void Start()
  45.     //{
  46.     //    Console.WriteLine("Started!");
  47.     //}
  48.  
  49.     public bool authenticate(string username, string password)
  50.     {
  51.         serverUsername = "aa";
  52.         serverPassword = "123";
  53.  
  54.         if (username == serverUsername && password == serverPassword)
  55.         {
  56.             authenticated = true;
  57.         }
  58.         else
  59.         {
  60.             authenticated = false;
  61.         }
  62.  
  63.  
  64.         return authenticated;
  65.  
  66.     }
  67.  
  68.  
  69. }
Add Comment
Please, Sign In to add comment