Comments (5)
Wired Character in Java socket output stream
import java.net.ServerSocket;
import java.net.Socket;
import java.io.ObjectOutputStream;
import java.io.PrintStream;
import java.io.DataOutputStream;
public class Server {
public static void main(String[] args) {
try {
ServerSocket server_socket = new ServerSocket(11451);
Socket client_socket = server_socket.accept();
PrintStream print_output_stream = new PrintStream(new ObjectOutputStream(client_socket.getOutputStream()));
while (true) {
print_output_stream.println("hello world");
print_output_stream.flush();
Thread.sleep(1145);
}
} catch (Exception e) {
// do nothing
}
}
}
telnet 127.0.0.1 11451
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
��w
hello world
w
hello world
w
hello world
w
hello world
w
hello world
Solution by @Origami404
Just remove ObjectOutputStream
PrintStream print_output_stream = new PrintStream((client_socket.getOutputStream());
from weekly.
Auto type inferring in java
from weekly.
音乐推荐:
- 作品名:ゴローンゴローン~フンコロガシ~
- 专辑:?
- 作词 : Nem
- 演唱:鎖那 / ホロホロ鳥
- 作曲:Nem
- 演奏:?
- 专辑流派:?
- 收听链接:https://music.163.com/#/song?id=409941268
滚啊滚啊 Archlinux
from weekly.
from weekly.
from weekly.
Related Issues (20)
- Turn on the comment or not ? HOT 8
- week-2 content solicitation HOT 8
- Add picture for week-1 news HOT 2
- 搜索好像不太好用 HOT 1
- Cache dependencies in 'picture generation' action HOT 4
- Use shorten URL in generated picture HOT 8
- 第三周内容征集 HOT 17
- Short title proposal HOT 1
- 第四周内容征集 HOT 5
- 第五周周报内容征集 HOT 3
- 生成的图片里图片居中 HOT 1
- 第六周周报内容征集 HOT 11
- 第七周周报内容征集 HOT 4
- 第八周周报内容征集 HOT 5
- 第九周周报内容征集 HOT 20
- 第十一周周报征询 HOT 1
- 行内 img 居中 HOT 3
- <summary> 下方添加 margin HOT 2
- 十二周周报征集
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weekly.