Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions src/main/java/javaSe/netORio/net/web/TcpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,15 @@ public static void main(String[] args) throws Exception {
}

private static void main0(String[] args) {
Socket s;
try {
s = new Socket(InetAddress.getLocalHost().getHostAddress(), 10002);
}
catch (IOException e) {
throw new RuntimeException(e);
}

try(ObjectOutputStream oos = new ObjectOutputStream(s.getOutputStream());){
try(Socket s = new Socket(InetAddress.getLocalHost().getHostAddress(), 10002);
ObjectOutputStream oos = new ObjectOutputStream(s.getOutputStream());){

User u = new User("jiumao");
u.setBirthday(new Date());
oos.writeObject(u);
}catch (Exception e) {
}finally {
try {
s.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
}
}