一、java网络编程 和 java web有什么区别?
网络编程主要是网络通信,实现计算机之间的对话和文件传输。
WEB编程主要就是网站开发。
一个是c/s架构(应用软件,桌面应用程序又称之为客户端-服务器应用程序,Client/Server)
另一个是b/s架构(网站又称浏览器-服务器应该程序,Browser/Server)。
可想而知,您说哪个是主流和非主流呢? 最近做的一个WEB站点 睡美人乐淘网
二、java最基础网络编程
看看文档就解决了
InputStream
java.net.Socket.getInputStream()
throws IOException
Returns an input stream for this socket.If this socket has an associated channel then the resulting input stream
delegates all of its operations to the channel. If the channel is in
non-blocking mode then the input stream's read operations will throw an
java.nio.channels.IllegalBlockingModeException.Under abnormal conditions the underlying connection may be broken by the
remote host or the network software (for example a connection reset in the case
of TCP connections). When a broken connection is detected by the network
software the following applies to the returned input stream :-
The network software may discard bytes that are buffered by the socket. Bytes
that aren't discarded by the network software can be read using read.
If there are no bytes buffered on the socket, or all buffered bytes have been
consumed by read,
then all subsequent calls to read
will throw an IOException.
If there are no bytes buffered on the socket, and the socket has not been
closed using close,
then available
will return 0.
Closing the returned InputStream
will close the associated socket.
最后一行,关闭返回的输入流将会关闭关联的socket
三、网络JAVA编程
买本java书,比较基础一点的,然后在用用eclipse编编简单的程序。
四、一个最简单的java网络编程
你好:Socket s = new Socket(localhost, 6660);//14行
这个的话,你的没通, 去黑窗口输入 tenlet 127.0.0.1 6660;看看是否有结果输出,再就是你别用localhost了,换成实际的127.0.0.1的地址,