tcp服务器虚拟ip,TCPSocket到虚拟机的IP地址

我想在我的windows pc和linux虚拟机之间建立套接字通信。windows机器就是服务器。我写了一个C++程序,在WiPC上建立服务器,在PM上设置客户机的Python程序,但是如何连接它们呢?我使用SOCK_STREAM和AF_INET,所以我需要一个portnr和ip地址来连接到服务器。我只是想知道我应该使用什么IP地址,因为它不适用于IPv4,这是因为它是错误的IP地址还是因为我的程序出错?在

编辑1:很抱歉数据不足:

我使用Oracle虚拟机,它的networkconfig设置为default,NAT。当我在主机(windows)命令中运行ipconfig时。我得到多个IP地址:Windows IP Configuration

Wireless LAN adapter Wireless Network Connection:

Media State . . . . . . . . . . . : *

Connection-specific DNS Suffix . : *

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . : ********

Link-local IPv6 Address . . . . . : *

IPv4 Address. . . . . . . . . . . : *

Subnet Mask . . . . . . . . . . . : *

Default Gateway . . . . . . . . . : *

**Ethernet adapter VirtualBox Host-Only Network:

Connection-specific DNS Suffix . :*

Link-local IPv6 Address . . . . . : *

Autoconfiguration IPv4 Address. . : *

Subnet Mask . . . . . . . . . . . : '*

Default Gateway . . . . . . . . . :***

Tunnel adapter isatap.{*}:

Media State . . . . . . . . . . . : Media disconnected

Connection-specific DNS Suffix . :

Tunnel adapter 6TO4 Adapter:

Connection-specific DNS Suffix . : ********

IPv6 Address. . . . . . . . . . . : *

Default Gateway . . . . . . . . . :

Tunnel adapter isatap.{5289AB9F-2C9F-4CBE-B826-149B3CFBB45F}:

Media State . . . . . . . . . . . : Media disconnected

Connection-specific DNS Suffix . :*

Tunnel adapter isatap.******:

Media State . . . . . . . . . . . : Media disconnected

Connection-specific DNS Suffix . : *******

Tunnel adapter Teredo Tunneling Pseudo-Interface:

Media State . . . . . . . . . . . : Media disconnected

Connection-specific DNS Suffix . :*

我倾向于得出结论,在“以太网适配器VirtualBox-Only-Network”下的IPv6地址是正确的。我尝试过ping LAN地址和VirtualBox主机专用网络地址,它们都会产生结果。我也试过在候机楼追踪,但都没用。有什么想法吗?在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值