Java Socket绑定本地接口(ppp0)

时间:2013-09-03 20:42:04

标签: java linux sockets networking network-programming

我尝试通过这种方式使用ppp0端点释放java套接字连接:

Socket socket = new Socket(InetAddress.getByName("200.147.67.142"), 80, InetAddress.getByName("189.116.7.204"), 4447);

其中189.116.7.204是ppp0接口的IP地址,200.147.67.142是目标。

问题是: TimeoutException

我的网络配置:

ifconfig -a
eth0      Link encap:Ethernet  Endereço de HW b8:27:eb:fb:45:a6
          UP BROADCASTMULTICAST  MTU:1500  Métrica:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          colisões:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Loopback Local
          inet end.: 127.0.0.1  Masc:255.0.0.0
          UP LOOPBACKRUNNING  MTU:16436  Métrica:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          colisões:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ppp0      Link encap:Protocolo Ponto-a-Ponto
          inet end.: 189.116.7.204  P-a-P:10.64.64.64  Masc:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Métrica:1
          RX packets:24 errors:0 dropped:0 overruns:0 frame:0
          TX packets:25 errors:0 dropped:0 overruns:0 carrier:0
          colisões:0 txqueuelen:3
          RX bytes:408 (408.0 B)  TX bytes:537 (537.0 B)

wlan0     Link encap:Ethernet  Endereço de HW c8:3a:35:ca:4c:50
          inet end.: 10.0.1.16  Bcast:10.0.1.255  Masc:255.255.255.0
          UP BROADCASTRUNNING MULTICAST  MTU:1500  Métrica:1
          RX packets:35080 errors:0 dropped:1164 overruns:0 frame:0
          TX packets:32267 errors:0 dropped:0 overruns:0 carrier:0
          colisões:0 txqueuelen:1000
          RX bytes:23543046 (22.4 MiB)  TX bytes:11526680 (10.9 MiB)

wwan0     Link encap:Ethernet  Endereço de HW 58:2c:80:13:92:63
          UP BROADCASTRUNNING MULTICAST  MTU:1500  Métrica:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          colisões:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

感谢您的帮助......

0 个答案:

没有答案