📄 sessionclient.java
字号:
package com.laoer.bbscs.servlet;
import java.net.*;
import java.io.*;
import com.laoer.bbscs.sysinfo.*;
import org.apache.log4j.*;
public class SessionClient {
static Logger logger = Logger.getLogger(SessionClient.class.getName());
private String host = "";
private int port = Sys.SYSINFO.PORT;
public SessionClient(String ahost, int aport) {
this.host = ahost;
this.port = aport;
}
public void sendUserSession(UserSession aUserSession) {
try {
Socket socket = new Socket(host, port);
ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream());
output.writeObject(aUserSession);
socket.close();
}
catch (UnknownHostException e) {
logger.error(e);
}
catch (IOException e) {
logger.error(e);
}
}
public void sendUpMsg(UpMsg aUpMsg) {
try {
Socket socket = new Socket(host, port);
ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream());
output.writeObject(aUpMsg);
socket.close();
}
catch (UnknownHostException e) {
logger.error(e);
}
catch (IOException e) {
logger.error(e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -