问题标签 [send]

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 投票
2 回答
3085 浏览

sharepoint - SPUtility 发送电子邮件时出错

我正在尝试在 webpart 中的按钮单击事件中发送电子邮件。但是,电子邮件发送失败,并且在机器的共享点日志和事件查看器中都记录了错误。错误是:无法连接到 SMTP 主机

中央管理中的外发电子邮件设置已配置。警报也工作正常。

下面是我的代码:

提前致谢

0 投票
1 回答
6597 浏览

c - Why is it assumed that send may return with less than requested data transmitted on a blocking socket?

The standard method to send data on a stream socket has always been to call send with a chunk of data to write, check the return value to see if all data was sent and then keep calling send again until the whole message has been accepted.

For example this is a simple example of a common scheme:

Even the BSD manpage mentions that

...If no messages space is available at the socket to hold the message to be transmitted, then send() normally blocks...

Which indicates that we should assume that send may return without sending all data. Now I find this rather broken but even W. Richard Stevens assumes this in his standard reference book about network programming, not in the beginning chapters, but the more advanced examples uses his own writen (write all data) function instead of calling write.

Now I consider this still to be more or less broken, since if send is not able to transmit all data or accept the data in the underlying buffer and the socket is blocking, then send should block and return when the whole send request has been accepted.

I mean, in the code example above, what will happen if send returns with less data sent is that it will be called right again with a new request. What has changed since last call? At max a few hundred CPU cycles have passed so the buffer is still full. If send now accepts the data why could'nt it accept it before?

Otherwise we will end upp with an inefficient loop where we are trying to send data on a socket that cannot accept data and keep trying, or else?

So it seems like the workaround, if needed, results in heavily inefficient code and in those circumstances blocking sockets should be avoided at all an non blocking sockets together with select should be used instead.

0 投票
2 回答
73139 浏览

c# - 在 C# 中发送 UDP 数据包

我有一个游戏服务器(魔兽世界)。我希望我的玩家将我的自定义补丁下载到游戏中。我已经完成了一个检查更新/下载内容的程序。如果玩家拥有我所有的补丁,我希望我的程序向我的游戏服务器发送一个数据包。我不需要服务器的任何响应,它会处理它,但它是另一个故事。

所以我想知道,如何将数据包发送到服务器。

谢谢!

0 投票
3 回答
849 浏览

python - 什么更快:多个“发送”或使用缓冲?

我正在玩 C/Python 中的套接字,我想知道将标头从 Python 字典发送到客户端套接字的最有效方法是什么。

我的想法:

  1. 对每个标题使用send调用。优点:不需要内存分配。缺点:很多send电话——可能容易出错;错误管理应该相当复杂
  2. 使用缓冲区。优点一次 send调用,错误检查更容易。缺点:需要一个缓冲区 :-) malloc/realloc应该相当慢,并且使用(太大)缓冲区以避免realloc调用浪费内存。

对我有什么建议吗?谢谢 :-)

0 投票
2 回答
13624 浏览

c# - 使用 gmail smtp 通过代理发送电子邮件

试图在我的 C# 应用程序中发送一些电子邮件。我在代理后面 - 这无疑是代码不起作用的原因。这是我到目前为止所拥有的:

应用程序配置

代码

每次我得到 System.Net.WebException:无法解析远程名称:'smtp.gmail.com'

我在哪里/如何开始调试?

0 投票
3 回答
1512 浏览

asp.net - 发送多封电子邮件

我正在使用 smtp 客户端和 MailMessage 类向用户发送电子邮件。

我一直在 MailMessage 类对象的 to 属性中添加多个接收者的地址。问题是收件人可以看到其他收件人的电子邮件地址。有什么办法可以隐藏其他收件人的电子邮件地址。

我的意思是设置一些属性或类似的东西。

否则我将只能选择向用户发送个人电子邮件。

请提供任何帮助

0 投票
2 回答
1946 浏览

c - C套接字编程:客户端发送()但服务器选择()没有看到它

我有一个服务器和一个客户端在两台不同的机器上运行,其中客户端send()但服务器似乎没有收到消息。服务器select()用于监视任何传入连接/消息的套接字。我可以看到,当服务器接受新连接时,它会更新fd_set数组,但总是返回 0,尽管有客户端send()消息。连接是 TCP 并且机器被一个路由器隔开,因此丢弃数据包的可能性很小。

我有一种感觉,问题可能不是来自客户,select()而是来自客户,但我不确定如何对问题区域进行本地化。send()sendto()

}

上面是服务器端代码,其中服务器有一个select()无限期运行的线程。

这是客户端连接并发送消息并返回

0 投票
1 回答
1125 浏览

ruby - Send instance method to module

Given the following module,

What code should go in send_to_foo to make the last line work as expected? (send_to_foo is obviously not how I would implement this; it just makes clearer what I'm looking for.)

I expected Foo.send(:bar) to work at first, but it makes sense that it doesn't. It would if the method were defined as def self.bar, but that's no fun.

0 投票
3 回答
989 浏览

object - NServiceBus 发送数据问题

我正在使用 NServices 发送 MyMusicMessage 类的对象作为打击:

当 MusicBytes 的大小在 200k 左右时,可以很好地发送。

但是当大小超过 300K 时,就会出现“MessageQueueException”。

NServiceBus 中的对象大小是否有限制?

谢谢。

0 投票
1 回答
688 浏览

php - 使用 jQuery 将多维数组发送到 php

嗨,我这里有一个小问题:)

在我上传一些图片后,我会得到一个包含所有图片的列表。我有一些用于旋转、复制、删除、随机播放图像的 jQuery 函数!当我选择一张图片并点击删除时,我会向 php 发送一个带有alt=""图片值的帖子,我会识别图片并进行编辑。

我想制作一个保存按钮,而不是每次旋转图像时都发送帖子,最好在使用包含所有数据的数组编辑图像列表后发送帖子?

上传后我的 php 数组如下所示:

说我上传了4张图片,

  • 第一张照片我旋转 90 度
  • 第二个我想复制
  • 第三个我旋转270度
  • 我删除的第四张图片

我只能用 jQuery 来做这一切,但是在服务器上图像是相同的,刷新后图像是相同的

这是带有图像的列表:

如果我像这样制作一个数组就可以了

我如何制作/发送/缓存这个数组?

对不起我的英语很糟糕

编辑:

是的,我使用 jSON 从 php 接收数组,如下所示: