你好:Socket s = new Socket("localhost", 6660);//14行 这个的话,你的没通, 去黑窗口输入 tenlet 127.0.0.1 6660;看看是否有结果输出,再就是你别用localhost了,换成实际的127.0.0.1的地址,
一、建立服务器类 Java中有一个专门用来建立Socket服务器的类,名叫ServerSocket,可以用服务器需要使用的端口号作为参数来创建服务器对象。ServerSocket server = new ServerSocket(9998) 这条语句创建了一个服务器对象,这个服务器使用9998号端口。当一个客户端程序建立一个Socket连接,所连接的端口号为9...
最基本的步骤一般都是这三个步骤,在实际实现时,步骤2会出现重复,在进行代码组织时,由于网络编程是比较耗时的操作,所以一般开启专门的现场进行网络通讯。二、服务器端网络编程步骤 服务器端(Server)是指在网络编程中被动等待连接的程序,服务器端一般实现程序的核心逻辑以及数据存储等核心功能。服务器端...
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 op...
import java.io.*;public class chatClient extends Frame { / param args / TextField tfTxT=new TextField();TextArea taContent=new TextArea();Socket s=null;DataOutputStream dos=null;DataInputStream dis=null;private boolean bConnected =false;public static void main(String[] args) {...