コード例 #1
0
ファイル: UserSockets.cs プロジェクト: guideX/WPSocketServer
 /// <summary>
 /// Create User Socket
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public int Create(string description, int userId, string serverIp, int port, int serviceTypeId)
 {
     try {
         var connectionId = ConnectionsHelper.Create(new Models.ConnectionModel()
         {
             Connected     = false,
             Description   = description,
             Monitoring    = false,
             Port          = port,
             Server        = serverIp,
             UserId        = userId,
             ServiceTypeId = serviceTypeId
         });
         var s = new UserSocket(userId, description, serverIp, port, connectionId);
         _userSockets.Add(s);
         return(s.Model.ConnectionId);
     } catch (Exception ex) {
         if (ProcessError != null)
         {
             ProcessError(ex, "Create");
         }
         return(0);
     }
 }
コード例 #2
0
 /// <summary>
 /// Create User Socket
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public int Create(string description, int userId, string serverIp, int port, int serviceType)
 {
     try {
         var connectionId = ConnectionsHelper.Create(new Models.ConnectionModel() {
             Connected = false,
             Description = description,
             Monitoring = false,
             Port = port,
             Server = serverIp,
             UserId = userId,
             ServiceType = serviceType
         });
         var s = new UserSocket(userId, description, serverIp, port, connectionId);
         _userSockets.Add(s);
         return s.Model.ConnectionId;
     } catch (Exception ex) {
         if (ProcessError != null) {
             ProcessError(ex, "Create");
         }
         return 0;
     }
 }