package server;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
public class textserver {
public static void main(String[] args) throws IOException {
@SuppressWarnings("resource")
ServerSocket server = new ServerSocket(9999);
System.out.println("服务端已启动");
Socket clinet= server.accept();
Socket client = null;
@SuppressWarnings("null")
InputStream iS= (InputStream) client.getInputStream();
System.out.println((char)iS.read());
OutputStream os= (OutputStream) client.getOutputStream();
os.write("收到了".getBytes());
if (os!=null) {
os.close();
}
if (iS!=null) {
iS.close();
}
if (clinet!=null) {
clinet.close();
}
}
}
为什么13行会报错呢 提示未知来源
