关于socket编程的问题,请高手指教! 你server端(192.168.0.156)开8886端口了吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我是把这个语句放在try里啊,我的server端已经开了8886端口了,不知道为什么? 你开个dos窗口,输入telnet 192.168.0.156 8886看看是否真的开了 import java.io.*;import java.net.*;import java.util.Random;public class ReceivePingResponse{ private static int DEFAULT_PORT = 100; private InetAddress m_target; public int test; public String isPingable = null; public StringBuffer revline; public ServerSocket ss; public void ReceivePingResponse(){ try{ ss = new ServerSocket(DEFAULT_PORT,3); }catch(Exception e){ e.printStackTrace(); } } public void run(){ try{ while(true){ Socket client = ss.accept(); } }catch(Exception e){ }} public static void main(String[] args){ ReceivePingResponse rpr = new ReceivePingResponse(); rpr.run(); }}我的程序是这样,为什么执行后没有打开端口呢? 你的DEFAULT_PORT值不是100吗?你是想打开100端口吗?应该是你说的8886才对呀? jComboBox选择变化问题 包的问题 请看一这打印程序有什么问题? 关于jar文件双击运行----奇怪问题 如何从字符窜"abc([email protected]); xyz([email protected])"中分析出有效邮件地址。 从哪儿可以下到电子版《Thinking in JAVA》? 试想一个方法/数据结构,实现无限长度有理数的四则及混合运算。 我对Java的见解,学Java注定 码农一个 一个很简单的问题? Server and Client! 散分的小问题2 散分的小问题
import java.net.*;
import java.util.Random;public class ReceivePingResponse{ private static int DEFAULT_PORT = 100;
private InetAddress m_target;
public int test;
public String isPingable = null;
public StringBuffer revline;
public ServerSocket ss; public void ReceivePingResponse(){
try{
ss = new ServerSocket(DEFAULT_PORT,3);
}catch(Exception e){
e.printStackTrace();
}
}
public void run(){
try{
while(true){
Socket client = ss.accept();
}
}catch(Exception e){
}}
public static void main(String[] args){
ReceivePingResponse rpr = new ReceivePingResponse();
rpr.run();
}
}
我的程序是这样,为什么执行后没有打开端口呢?