客户端通过 wifi 连接到服务器的连接失败错误(c 中的 TCP 套接字程序)

客户端通过 wifi 连接到服务器的连接失败错误(c 中的 TCP 套接字程序)

要求:需要使用 C 语言中的 TCP 套接字编程从通过 wifi 连接的两个设备发送和接收消息。

客户端套接字接收连接失败。我可以使用相同的 C 语言套接字程序通过 USB 连接相同的客户端。以下是配置详细信息。

两个 IP 位于同一子网。

系统:Ubuntu 14.04 防火墙:已禁用

abhishek@vidyut:~$sudo ufw status
Status: inactive

客户端配置详情:

root@swi-mdm9x15:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 2A:DF:53:54:15:A2  
          inet addr:192.168.17.1  Bcast:192.168.17.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:125 errors:0 dropped:0 overruns:0 frame:0
          TX packets:125 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:8851 (8.6 KiB)  TX bytes:8851 (8.6 KiB)

rmnet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:100.81.198.219  Mask:255.255.255.248
          inet6 addr: fe80::a5e8:cd72:5a0:d0ab/64 Scope:Link
          UP RUNNING  MTU:1430  Metric:1
          RX packets:29 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3394 (3.3 KiB)  TX bytes:3912 (3.8 KiB)

usb0      Link encap:Ethernet  HWaddr BE:B3:25:7B:2A:D1  
          inet addr:192.168.2.2  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::bcb3:25ff:fe7b:2ad1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:185 errors:0 dropped:0 overruns:0 frame:0
          TX packets:87 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:19533 (19.0 KiB)  TX bytes:11725 (11.4 KiB)

wlan0     Link encap:Ethernet  HWaddr 7C:DD:90:CB:FE:1D  
          inet addr:**192.168.1.4**  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::7edd:90ff:fecb:fe1d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:2004 (1.9 KiB)

root@swi-mdm9x15:~#

==============================================================

服务器端配置详细信息:

abhishek@vidyut:~$ifconfig
eth0      Link encap:Ethernet  HWaddr d0:bf:9c:05:bd:65  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:23702 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23702 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:1997818 (1.9 MB)  TX bytes:1997818 (1.9 MB)

usb0      Link encap:Ethernet  HWaddr 02:a5:2c:72:e1:95  
          inet addr:192.168.2.3  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a5:2cff:fe72:e195/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:520 errors:0 dropped:0 overruns:0 frame:0
          TX packets:652 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:286008 (286.0 KB)  TX bytes:66095 (66.0 KB)

wlan0     Link encap:Ethernet  HWaddr 74:29:af:18:6a:e9  
          inet addr:**192.168.1.32**  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::7629:afff:fe18:6ae9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:137395 errors:0 dropped:0 overruns:0 frame:0
          TX packets:81588 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:107297162 (107.2 MB)  TX bytes:15416536 (15.4 MB)

相关内容