问题标签 [winsock]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
12774 浏览

windows-server-2003 - Winsock - 10038 错误 - Win2K3 服务器 - 令人费解的行为

尝试通过套接字发送消息失败,出现 WinSock 错误 10038。大约 40 秒后,从同一个套接字成功接收到消息,随后 send() 在同一个套接字中也成功。此行为已在 Windows Server 2003 中出现。这是 WinSock 和 Windows Server 2003 的任何已知行为吗?

0 投票
4 回答
20719 浏览

c# - 什么是 .net / c# 套接字编程的好教程/howto

我正在将使用 Winsock 控件的旧 VB6 代码移植到 C#。我没有做过任何套接字编程,我想知道是否有人有一个很好的参考/教程/howto,我可以用来开始加快速度。

当我继续进行通常效率低下的谷歌搜索时,我正在吸引蜂巢思维。

我现在使用的是 UDP,而不是 TCP。

0 投票
2 回答
23948 浏览

events - VisualBasic 中的 MSWinsock.Winsock 事件处理

我正在尝试使用以下代码处理 Winsock_Connect 事件(实际上我在 Excel 宏中需要它):

但它永远不会进入 Winsock1_Connect 子例程,尽管 Winsock1.State 是“已连接”。我想使用标准 MS 库,因为我在我的 PC 上没有管理权限,而且我无法注册一些自定义库。谁能告诉我,我错在哪里?

0 投票
5 回答
9747 浏览

c++ - 套接字异常:“端点映射器没有更多可用的端点”

我正在使用 winsock 和 C++ 来设置服务器应用程序。我遇到的问题是调用listen导致第一次机会异常。我想通常这些可以忽略(?),但我发现其他人有同样的问题,它导致应用程序每隔一段时间就会挂起。任何帮助将不胜感激。

第一次机会例外是:

MyApp .exe中 0x*12345678* 处的第一次机会异常:0x000006D9:端点映射器中没有更多可用的端点。

我发现一些证据表明这可能是由套接字引起的,我正在使用的代码如下。listen异常发生在从底部数第五行的调用中。

0 投票
1 回答
478 浏览

visual-studio - 构建 Apache Axis2/C 时未声明的标识符 SO_EXCLUSIVEADDRUSE

我正在尝试构建 Apache Axis2/C(实际上我正在为它构建 WSO2 WSF/C++ 包装器),当它遇到符号时它一直给我一个错误SO_EXCLUSIVEADDRUSE。这是一个套接字选项,MSDN 说它应该可用。我在 Win Server 2k3 上使用 MSVC++ 6.0。我对编译器或操作系统没有选择权......如果我在 linux 上,我已经完成了:P

我查看了一个 VS2005 安装,发现它#define在 winsock2.h 中包含该常量。它不在我用于 MSVC6 的 winsock2.h 中。此外,在 VS2005 中,它位于 VS2005 目录内的 PlatformSDK 文件夹下,而 MSVC6 似乎没有任何此类目录。为什么这个符号不见了?我怎么才能得到它?我很想把它复制过来,但谁知道我还会错过什么……有什么想法吗?

0 投票
4 回答
820 浏览

winsock - 与 BSD 样式的套接字函数相比,使用 windows winsock API 函数有什么好处吗?

与 BSD 风格的函数相比,在 Windows 上使用 WSA winsock 函数有什么好处吗?

0 投票
2 回答
5164 浏览

networking - Difference between winsock and linux sockets

I'm developing an FTP-like program to download a large number of small files onto an Xbox 360 devkit (which uses Winsock), and porting it to Playstation3 (also a devkit, and uses linux AFAIK). The program uses BSD-style sockets (TCP). Both of the programs communicate with the same server, downloading the same data. The program iterates through all the files in a loop like this:

On the Xbox 360 implementation, the whole download takes 1:27, and the time between the last send and first receive takes about 14 seconds. This seems quite reasonable to me.

The Playstation3 implementation takes 4:01 for the same data. The bottleneck seems to be between the last send and first receive, which takes up 3:43 of that time. The network and disk times are both significantly less than the Xbox 360.

Both these devkits are on the same switch as my PC, which does the file serving, and there is no other traffic on said switch.

I've tried setting the TCP_NODELAY flag, which didn't change things significantly. I've also tried setting the SO_SNDBUF/SO_RCVBUF to 625KB, which also didn't significantly affect the time.

I'm assuming that the difference lies between the TCP/IP stack implementations between Winsock and linux; is there some socket option that I could set to make the linux implementation behave more like Winsock? Is there something else I'm not accounting for?

The only solution looks to be to rewrite it so that it sends all the file requests together, then receives them all.

Unfortunately, Sony's implementation does not have the TCP_CORK option, so I cannot say if that is the difference.

0 投票
1 回答
1083 浏览

c++ - 如何使用 Winsock 从数据报的 IP 标头中获取源 IP 地址?

我有一个绑定()到 INADDR_ANY 的端口。我正在成功接收数据报。收到后需要读取IP头来获取源IP地址。

0 投票
1 回答
1067 浏览

bitmap - 用winsock发送位图

你怎么能通过winsock发送一个位图而不将它保存到一个文件然后发送呢?如果您知道如何在接收回位图后将数据转换为位图,这也会很有帮助。

0 投票
4 回答
1864 浏览

vb6 - Microsoft 补丁 958369 MS08-070 破坏了我的 VB6 应用程序(类型不匹配 - 动态创建的控件)

我们用上面列出的微软补丁升级了我们的机器,现在遇到了一些 winsock 控件的问题。在继续使用新的组件库时,我们面临两个问题:

  • 我们正在使用 Form.Controls.Add(...) 动态创建 Winsock 控件。使用新的 dll,它给了我们一个运行时错误 731,说明我们需要添加许可证。

此问题已通过在添加控件之前添加一行 License.Add(PrgID of the control) 得到解决。

现在的问题是,当我们尝试将此控件设置为 mWinsock 类型的对象时,我们会收到运行时错误类型不匹配。有什么想法吗?