关于java:基于RMI和Socket的Java聊天软件

RMI定义近程办法提供给客户端调用
定义的接口:(须要实现
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.sql.SQLException;
import java.util.ArrayList;
public interface ServerMethod extends Remote {

/**
 *RMI办法
 * 登录 登录胜利返回true 否则返回false
 * @param   UID  用户UID
 * @param   Password 用户明码
 * @see boolean
 */
public boolean Login(String UID,String Password) throws RemoteException, SQLException;//登录
/**
 *RMI办法
 * 注册 注册胜利返回true 否则返回false
 * @param   UID  用户UID
 * @param   Password 用户明码
 * @param Nickname 昵称
 * @see boolean
 */
public boolean Register(String UID ,String Password,String Nickname)throws SQLException,RemoteException;//注册
/**
 *RMI办法
 * 获取存在数据库的未读音讯
 * @param   UID  用户UID
 * @see ArrayList
 */
public ArrayList<String> getDBMessage(String UID) throws SQLException,RemoteException;//获取存储在数据库的音讯
/**
 *RMI办法
 * 获取好友列表
 * @param   UID  用户UID
 * @see ArrayList
 */
public ArrayList<String> getAllFriends(String UID) throws SQLException,RemoteException;//获取好友列表 格局: UID:Nickname
/**
 *RMI办法
 * 发送音讯
 * @param   UID  发送者UID
 * @param Nickname 昵称
 * @param  ReceiveID 接收者ID
 * @param content  内容
 * @see ArrayList
 */
public boolean SendMessage(String UID,String Nickname,String ReceiveID,String content) throws SQLException,RemoteException;//对方还不是好友,则发送失败
/**
 *RMI办法
 * 获取实时音讯
 * @param   UID  用户UID
 * @see ArrayList
 */
public  ArrayList<String> GetMessage(String UID) throws Exception;//实时音讯获取
/**
 *RMI办法
 * 发送群聊音讯 [Skrill下载](https://www.gendan5.com/wallet/Skrill.html)发送胜利返回true
 * @param   UID  发送者UID
 * @param   Nickname 昵称
 * @param   GroupUID 群组UID
 * @param   content 内容
 * @see boolean
 */
public boolean SendMessageToGroup(String UID,String Nickname,String GroupUID,String content)throws SQLException,RemoteException;//向群聊发送音讯
/**
 *RMI办法
 * 发送群聊音讯 发送胜利返回true
 * @param   SendUID  发送者UID
 * @param   Nickname 昵称
 * @param   ReceiveUID 接收者UID
 * @param   content 内容
 * @see boolean
 */
public boolean AddFriendsRequest(String SendUID,String ReceiveUID,String Nickname,String content)throws SQLException,RemoteException;//发送增加好友申请
/**
 *RMI办法
 * 删除关系
 * @param   ID1 ID2
 * @param   ID2 ID1
 */
public void DeleteFriend(String ID1,String ID2)throws SQLException,RemoteException;//删除关系
/**
 *RMI办法
 * 新建群聊
 * @param   SendUID ID2
 * @param   GID ID1
 */
public boolean NewGroup(String SendUID,String GID)throws SQLException,RemoteException;//新建群聊
/**
 *RMI办法
 * 增加群聊
 * @param   UID 用户ID
 * @param   GID 群聊ID
 */
public void AddGroup(String UID,String GID)throws SQLException,RemoteException;//增加群聊 无需验证
/**
 *RMI办法
 * 批改昵称
 * @param   UID 用户ID
 * @param   newNickname 新用户昵称
 * @see     boolean
 */
public boolean ChangeNickname(String UID,String newNickname)throws SQLException,RemoteException;//批改昵称
/**
 *RMI办法
 * 批改明码
 * @param   UID 用户ID
 * @param   newPassword 新密码
 * @see     boolean
 */
public boolean ChangePassword(String UID,String newPassword)throws SQLException,RemoteException;//批改明码
/**
 *RMI办法
 * 获取用户音讯
 * @param   UID 用户ID
 */
public String getUserInfo(String UID)throws SQLException,RemoteException;//获取用户信息 若为群组返回 G:GID 若为用户返回 U:UID:Nickname
/**
 *RMI办法
 * 批准增加好友
 * @param   SendUID 发送者ID
 * @param   ReceiveUID 接收者UID
 */
public  void AgreeAddFriendRequest(String SendUID,String ReceiveUID)throws SQLException,RemoteException;
/**
 *RMI办法
 * 回绝增加好友
 * @param   SendUID 发送者ID
 * @param   ReceiveUID 接收者UID
 */
public  void RefuseAddFriendRequest(String SendUID,String ReceiveUID)throws SQLException,RemoteException;

}

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理