Advertisement
Jinfaa

serverClass.cs

Feb 7th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using ServerAppSpace;
  6. using System.Runtime.InteropServices;
  7. using ServerClassSpace;
  8.  
  9. namespace ServerClassSpace
  10. {
  11.    // [ProgId("ServerClassSpace.ServerClass")]
  12.     public class ServerClass : MarshalByRefObject, IMyService
  13.     {
  14.         private IServerApp _theServer = null;               //this will be used to hold the server application's address..
  15.         public IServerApp TheMainServer
  16.         {
  17.             set
  18.             {
  19.                 _theServer = value;
  20.             }
  21.         }
  22.  
  23.         #region IMyService Implementation
  24.         //these functions are mainly used for transferring to requests of the clients to the server application...
  25.  
  26.         public void Logon(string machinename, string portno, string username)
  27.         {
  28.             _theServer.RegisterUser(machinename, portno, username);
  29.         }
  30.  
  31.         public void Logoff(string machinename, string username)
  32.         {
  33.             _theServer.UnRegisterUser(machinename, username);
  34.         }
  35.  
  36.         public void SendMessage(string sendermachine, string senderusername, string receiverusername, bool isGlobal, string msgString)
  37.         {
  38.             _theServer.SendMsg(sendermachine, senderusername, receiverusername, isGlobal, msgString);
  39.         }
  40.  
  41.         public string GetMessage(string machinename)
  42.         {
  43.             return _theServer.GetMsgs(machinename);
  44.         }
  45.  
  46.         public int GetPortNo()
  47.         {
  48.             return _theServer.ServerGivePortNo();
  49.         }
  50.  
  51.         public bool CanUseThisName(string username)
  52.         {
  53.             return _theServer.UserNameExists(username);
  54.         }
  55.  
  56.         #endregion
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement