如何调用NetMessageBufferSend发送消息?(改编)

手把手教你用mitmproxy抓包抖音数据流(附Python脚本模板) 本文详细介绍了如何使用mitmproxy抓包抖音数据流,包括环境搭建、证书安装和Python脚本模板。从mitmproxy配置到抖音API解析,提供完整的移动端数据流分析方案,帮助开发者快速掌握数据抓取技术,适用于应用优化、竞品分析和安全审计等场景。 阅读详情

如何调用NetMessageBufferSend发送消息?

问题描述:

如何调用WINNT/2K/XP下的API函数NetMessageBufferSend模拟net send命令来发送消息?

解决方案:

下面代码已测试成功,直接导入PBL即可

 

$PBExportHeader$w_main.srw

forward

global type w_main from Window

end type

type mle_1 from multilineedit within w_main

end type

type cb_1 from commandbutton within w_main

end type

type sle_1 from singlelineedit within w_main

end type

type st_2 from statictext within w_main

end type

type st_1 from statictext within w_main

end type

end forward

 

type icmp_echo_reply from structure

    unsignedlong        address

    unsignedlong        status

    unsignedlong        roundtriptime

    unsignedlong        datasize

    unsignedlong        reserved[3]

    character       data[250]

end type

global type w_main from Window

int X=1056

int Y=484

int Width=1531

int Height=1152

boolean TitleBar=true

string Title="NETMESSAGESEND"

long BackColor=80269524

boolean ControlMenu=true

boolean MinBox=true

boolean Resizable=true

mle_1 mle_1

cb_1 cb_1

sle_1 sle_1

st_2 st_2

st_1 st_1

end type

global w_main w_main

 

type prototypes

Function ulong NetMessageBufferSend(ulong servername, ref char msgname[],ulong fromname, ref char buf[], ulong buflen) Library "netapi32.dll" Alias for "NetMessageBufferSend"

Function ulong IcmpCreateFile () Library "icmp.dll"

Function long IcmpSendEcho (ulong IcmpHandle, ulong DestinationAddress, string RequestData,long RequestSize, long RequestOptions, Ref icmp_echo_reply ReplyBuffer, long ReplySize, long Timeout ) Library "icmp.dll" Alias for "IcmpSendEcho"

Function long IcmpCloseHandle (ulong IcmpHandle) Library "icmp.dll"

Function ulong inet_addr (string cp) Library "ws2_32.dll" Alias for "inet_addr"

end prototypes

type variables

CONSTANT ulong NERR_Success = 0

end variables

forward prototypes

public subroutine wf_string_to_unicode (string as_string, ref character ac_unicode[])

public subroutine wf_string_to_unicode (string as_string, ref character ac_unicode[])

public function boolean wf_netmessagebuffersend (string as_sendto, string as_msgtext)

public function boolean wf_ping (string as_ipaddress, string as_echomsg)

end prototypes

 

public subroutine wf_string_to_unicode (string as_string, ref character ac_unicode[]);Integer li_loop, li_len, li_uni

 

li_len = Len(as_string)

 

FOR li_loop = 1 TO li_len

    li_uni = li_uni + 1

    ac_unicode[li_uni] = Mid(as_string, li_loop, 1)

    li_uni = li_uni + 1

    ac_unicode[li_uni] = Char(0)

NEXT

 

li_uni = li_uni + 1

ac_unicode[li_uni] = Char(0)

li_uni = li_uni + 1

ac_unicode[li_uni] = Char(0)

 

end subroutine

public function boolean wf_netmessagebuffersend (string as_sendto, string as_msgtext);Ulong lul_result, lul_buflen

Char lc_msgname[],lc_msgtext[]

 

wf_string_to_unicode(as_sendto, lc_msgname)

wf_string_to_unicode(as_msgtext, lc_msgtext)

 

lul_buflen = UpperBound(lc_msgtext)

 

lul_result = NetMessageBufferSend(0, lc_msgname,0, lc_msgtext, lul_buflen)

 

If lul_result = NERR_Success Then

    Return True

Else

    Return False

End If

end function

public function boolean wf_ping (string as_ipaddress, string as_echomsg);ULong lul_address, lul_handle

Long ll_rc, ll_size

String ls_reply

icmp_echo_reply lstr_reply

 

lul_address = inet_addr(as_ipaddress)

If lul_address > 0 Then

    lul_handle = IcmpCreateFile()

    ll_size = Len(as_echomsg)

    ll_rc = IcmpSendEcho(lul_handle, lul_address, &

                        as_echomsg, ll_size, 0, &

                        lstr_reply, 278, 200)

    IcmpCloseHandle(lul_handle)

    If ll_rc <> 0 Then

        If lstr_reply.Status = 0 Then

            ls_reply = String(lstr_reply.Data)

            If ls_reply = as_echomsg Then

                Return True

            End If

        End If

    End If

End If

 

Return False

 

end function

on w_main.create

this.mle_1=create mle_1

this.cb_1=create cb_1

this.sle_1=create sle_1

this.st_2=create st_2

this.st_1=create st_1

this.Control[]={this.mle_1,&

this.cb_1,&

this.sle_1,&

this.st_2,&

this.st_1}

end on

 

on w_main.destroy

destroy(this.mle_1)

destroy(this.cb_1)

destroy(this.sle_1)

destroy(this.st_2)

destroy(this.st_1)

end on

 

type mle_1 from multilineedit within w_main

int X=27

int Y=264

int Width=1399

int Height=604

int TabOrder=20

BorderStyle BorderStyle=StyleLowered!

long TextColor=33554432

int TextSize=-10

int Weight=400

string FaceName="方正姚体"

FontCharSet FontCharSet=GB2312CharSet!

FontPitch FontPitch=Variable!

end type

 

type cb_1 from commandbutton within w_main

int X=1070

int Y=904

int Width=357

int Height=108

int TabOrder=30

string Text=" 发送(&S)"

int TextSize=-10

int Weight=400

string FaceName="方正姚体"

FontCharSet FontCharSet=GB2312CharSet!

FontPitch FontPitch=Variable!

end type

 

event clicked;if not wf_ping(trim(sle_1.text),"") then

    messagebox("提示","指定目标地址不存在或不通!")

    return

end if

 

if wf_NetMessageBufferSend(trim(sle_1.text),trim(mle_1.text)) then

   messagebox("提示","发送成功!")

else

   messagebox("提示","发送失败!")  

end if

end event

type sle_1 from singlelineedit within w_main

int X=430

int Y=48

int Width=997

int Height=92

int TabOrder=10

BorderStyle BorderStyle=StyleLowered!

boolean AutoHScroll=false

long TextColor=33554432

int TextSize=-10

int Weight=400

string FaceName="方正姚体"

FontCharSet FontCharSet=GB2312CharSet!

FontPitch FontPitch=Variable!

end type

 

type st_2 from statictext within w_main

int X=14

int Y=172

int Width=379

int Height=76

boolean Enabled=false

string Text="发送内容:"

boolean FocusRectangle=false

long TextColor=33554432

long BackColor=67108864

int TextSize=-10

int Weight=400

string FaceName="方正姚体"

FontCharSet FontCharSet=GB2312CharSet!

FontPitch FontPitch=Variable!

end type

 

type st_1 from statictext within w_main

int X=14

int Y=52

int Width=379

int Height=76

boolean Enabled=false

string Text="目标地址:"

boolean FocusRectangle=false

long TextColor=33554432

long BackColor=67108864

int TextSize=-10

int Weight=400

string FaceName="方正姚体"

FontCharSet FontCharSet=GB2312CharSet!

FontPitch FontPitch=Variable!

end type

**************************************************

另一种方法转换UNICODE:

$PBExportHeader$w_main.srw
forward
global type w_main from Window
end type
type mle_1 from multilineedit within w_main
end type
type cb_1 from commandbutton within w_main
end type
type sle_1 from singlelineedit within w_main
end type
type st_2 from statictext within w_main
end type
type st_1 from statictext within w_main
end type
end forward

type icmp_echo_reply from structure
 unsignedlong  address
 unsignedlong  status
 unsignedlong  roundtriptime
 unsignedlong  datasize
 unsignedlong  reserved[3]
 character  data[250]
end type

global type w_main from Window
int X=1056
int Y=484
int Width=1531
int Height=1152
boolean TitleBar=true
string Title="NETMESSAGESEND"
long BackColor=80269524
boolean ControlMenu=true
boolean MinBox=true
boolean Resizable=true
mle_1 mle_1
cb_1 cb_1
sle_1 sle_1
st_2 st_2
st_1 st_1
end type
global w_main w_main

type prototypes
Function ulong IcmpCreateFile () Library "icmp.dll"
Function long IcmpSendEcho (ulong IcmpHandle, ulong DestinationAddress, string RequestData,long RequestSize, long RequestOptions, Ref icmp_echo_reply ReplyBuffer, long ReplySize, long Timeout ) Library "icmp.dll" Alias for "IcmpSendEcho"
Function long IcmpCloseHandle (ulong IcmpHandle) Library "icmp.dll"
Function ulong inet_addr (string cp) Library "ws2_32.dll" Alias for "inet_addr"

Function ulong MultiByteToWideChar(ulong CodePage,ulong dwFlags,ref string lpMultiByteStr,ulong cchMultiByte,ref string lpWideCharStr,ulong cchWideChar) LIBRARY "kernel32.dll"
Function ulong NetMessageBufferSend(ulong servername, ref string msgname,ulong fromname, ref string buf, ulong buflen) Library "netapi32.dll" Alias for "NetMessageBufferSend"

end prototypes
type variables
CONSTANT ulong NERR_Success = 0
end variables

forward prototypes
public function boolean wf_netmessagebuffersend (string as_sendto, string as_msgtext)
public function boolean wf_ping (string as_ipaddress, string as_echomsg)
public function boolean wf_netmessagebuffersend (string as_sendto, string as_msgtext)
public function boolean wf_ping (string as_ipaddress, string as_echomsg)
end prototypes

public function boolean wf_netmessagebuffersend (string as_sendto, string as_msgtext);string ls_msgtext,ls_sendto,ls_wmsgtext,ls_wsendto,ls_char
Ulong ll_result,ll_lenstr

ls_sendto = as_sendto
ls_msgtext = as_msgtext

setnull(ls_char)
ll_lenstr = MultiByteToWideChar(0, 0, ls_sendto, -1, ls_char, 0)
ls_wsendto = space(ll_lenstr * 2)
ll_lenstr = MultiByteToWideChar(0, 0, ls_sendto, -1, ls_wsendto, ll_lenstr)

setnull(ls_char)
ll_lenstr = MultiByteToWideChar(0, 0, ls_msgtext, -1, ls_char, 0)
ls_wmsgtext = space(ll_lenstr * 2)
ll_lenstr = MultiByteToWideChar(0, 0, ls_msgtext, -1, ls_wmsgtext, ll_lenstr)

ll_result = NetMessageBufferSend(0, ls_wsendto,0 , ls_wmsgtext, ll_lenstr * 2)

If ll_result = NERR_Success Then
 Return True
Else
 Return False
End If
end function
public function boolean wf_ping (string as_ipaddress, string as_echomsg);ULong lul_address, lul_handle
Long ll_rc, ll_size
String ls_reply
icmp_echo_reply lstr_reply

lul_address = inet_addr(as_ipaddress)
If lul_address > 0 Then
 lul_handle = IcmpCreateFile()
 ll_size = Len(as_echomsg)
 ll_rc = IcmpSendEcho(lul_handle, lul_address, &
      as_echomsg, ll_size, 0, &
      lstr_reply, 278, 200)
 IcmpCloseHandle(lul_handle)
 If ll_rc <> 0 Then
  If lstr_reply.Status = 0 Then
   ls_reply = String(lstr_reply.Data)
   If ls_reply = as_echomsg Then
    Return True
   End If
  End If
 End If
End If

Return False

end function

on w_main.create
this.mle_1=create mle_1
this.cb_1=create cb_1
this.sle_1=create sle_1
this.st_2=create st_2
this.st_1=create st_1
this.Control[]={this.mle_1,&
this.cb_1,&
this.sle_1,&
this.st_2,&
this.st_1}
end on

on w_main.destroy
destroy(this.mle_1)
destroy(this.cb_1)
destroy(this.sle_1)
destroy(this.st_2)
destroy(this.st_1)
end on

type mle_1 from multilineedit within w_main
int X=27
int Y=264
int Width=1399
int Height=604
int TabOrder=20
BorderStyle BorderStyle=StyleLowered!
long TextColor=33554432
int TextSize=-10
int Weight=400
string FaceName="方正姚体"
FontCharSet FontCharSet=GB2312CharSet!
FontPitch FontPitch=Variable!
end type

type cb_1 from commandbutton within w_main
int X=1070
int Y=904
int Width=357
int Height=108
int TabOrder=30
string Text=" 发送(&S)"
int TextSize=-10
int Weight=400
string FaceName="方正姚体"
FontCharSet FontCharSet=GB2312CharSet!
FontPitch FontPitch=Variable!
end type

event clicked;if isnull(sle_1.text) or isnull(mle_1.text) or trim(sle_1.text) = "" or trim(mle_1.text) = "" then
 messagebox("提示","有未填项目!")
 return
end if

if not wf_ping(trim(sle_1.text),"") then
 messagebox("提示","指定目标地址不存在或不通!")
 return
end if

if wf_NetMessageBufferSend(trim(sle_1.text),trim(mle_1.text)) then
   messagebox("提示","发送成功!")
else
   messagebox("提示","发送失败!") 
end if
end event

type sle_1 from singlelineedit within w_main
int X=430
int Y=48
int Width=997
int Height=92
int TabOrder=10
BorderStyle BorderStyle=StyleLowered!
boolean AutoHScroll=false
long TextColor=33554432
int TextSize=-10
int Weight=400
string FaceName="方正姚体"
FontCharSet FontCharSet=GB2312CharSet!
FontPitch FontPitch=Variable!
end type

type st_2 from statictext within w_main
int X=14
int Y=172
int Width=379
int Height=76
boolean Enabled=false
string Text="发送内容:"
boolean FocusRectangle=false
long TextColor=33554432
long BackColor=67108864
int TextSize=-10
int Weight=400
string FaceName="方正姚体"
FontCharSet FontCharSet=GB2312CharSet!
FontPitch FontPitch=Variable!
end type

type st_1 from statictext within w_main
int X=14
int Y=52
int Width=379
int Height=76
boolean Enabled=false
string Text="目标地址:"
boolean FocusRectangle=false
long TextColor=33554432
long BackColor=67108864
int TextSize=-10
int Weight=400
string FaceName="方正姚体"
FontCharSet FontCharSet=GB2312CharSet!
FontPitch FontPitch=Variable!
end type

 

AI快速变现之路,AI视频创作 初期投入$3000(工具订阅+样片制作),重点攻克跨境电商和本地生活服务市场。关注2025年AIGC视频工具的API降价趋势(如Pika企业版折扣可达50%),建议与云服务商签订长期合作协议。 阅读详情

相关推荐

OCCT(Open CASCADE Technology)入门-2.搭建开发环境

安装完成后,在【扩展】菜单下会看到【Qt VS Tools】菜单,打开子菜单【options】进入qt配置窗口。打开VS后随便创建一个新项目,进入开发环境主页,打开顶部菜单【扩展】->【管理扩展】打开管理扩展窗口。然后点击右下角【创建】,一路【next】即可,最后会进入到开发主界面,得到一个下面的工程结构。好了,到这里基本的环境我们已经安装好了,下面我们开始创建项目并配置开发环境。打开顶部菜单【项目】,点击最后一个菜单项【xxx属性】,进入项目配置界面。这里的配置一般不用改,我们看【Versions】

2501_91235145的博客 2875

发送kafka报错:buffered messsge send to kafka err:Message size TooLarge

程序报错如下: 解决方案: 调整kafka对单条消息的大小限制:message.max.bytes从默认1M调整为10M,10M是cdh建议的最大值了,调整过大会影响kafka的吞吐量,同时需要调整replica.fetch.max.bytes的值需要大于等于message.max.bytes,该参数为broker同步的消息大小限制,如果小于message.max.bytes可能会出现broker接收消息但是主副本无法同步从而造成数据丢失。(我们用着的cdh的管理在界面可以调整整个集群的默认参数,如

battybaby的博客 2126

【从零开始学Skynet】实战篇《球球大作战》(一):功能设计

为了能把之前在基础篇中学习到的Skynet的各种知识结合起来,所以在实战篇中,我们准备开发一个完整的游戏案例《球球大作战》,介绍分布式游戏服务端的实现方法。

我是一条寻水的鱼 2978

pb利用NetMessageBufferSend在局域网发送中文消息(实现cmd中 NET SEND功能)

这是一个窗口w_main的导出对象,需要的自己保存为文件,再导入。         这个版本其实来自网上,只是网上的那个不能发送中文,现在做了修改,支持发送中文了。         记住,net send 依赖于系统服务Messenger,在使用API函数 NetMessag

yyoinge的专栏 2491

机器视觉检测到底怎么做,经验分享

笔者做机器视觉检测已经有五六年了,也算是对机器视觉的检测技术有了一定的掌握。总的来说,基于机器视觉的检测技术主要包含三个部分:视觉采集模块、后台分析模块和动作决策模块。这几个分类,跟教科书上的有较大差异,很多同学觉得我在杜撰。笔者也不作反驳,因为这是笔者这些年工作经验的总结,自然区别于教科书。下面我们分开来讲这几个模块,同时会把笔者之前的论文做个推荐总结。 所有文章均可在博主的主页中找到,若无法找到,可以用搜索工具。博主的主页: https://blog.youkuaiyun.com/Aoulun 第..

Aoulun的博客 8677

手把手教你从入门到精通C# 操作MySql数据库

本文是《C#操作MySql数据库从入门到精通》专栏的导读,帮助大家知道学习本专栏能够获取什么!

qq_34059233的博客 1932

【FreeRTOS(十五)】MessageBuffer

创建 xMessageBufferCreate 发送 xMessageBufferSend 接收 xMessageBufferReceive

K3169的博客 1053

2025实战|C#上位机+STM32实现LED串灯控制:串口通信+PWM调光+自定义帧协议(附上下位机源码)

粘包:一次收到“BRIGHT:50LED_OFF”,解析完全错乱;乱码:串口波特率/编码不匹配,指令变成“??H??50”;丢帧:数据传输中少字符,比如“BRIGHT:5”,解析出亮度5而非50。因此我们设计字节级自定义帧协议协议先行:无论简单还是复杂场景,先定义清晰的帧协议,避免数据错乱;串口稳字当头:下位机用环形缓冲区接收,上位机加锁发送,避免丢包/粘包;跨线程必处理:C#上位机所有UI更新必须用Invoke,否则必崩溃;硬件是基础:接线、供电、共地这些细节,比代码更易出问题;

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 755

C++消息炸弹程序

C++消息炸弹程序

yaosichengalpha的博客 752

C#实现低通和高通滤波算法

低通滤波器允许通过低于某个截止频率的信号成分,并且抑制高于该频率的成分。而高通滤波器则允许通过高于某个截止频率的信号成分,并抑制低于该频率的成分。巴特沃斯滤波器是一种对称的滤波器,具有平坦的幅度响应和最小的群延迟。低通和高通滤波是数字信号处理中常用的滤波技术,用于滤除或增强信号中的特定频率成分。在本篇文章中,我们将使用C#编程语言来实现低通和高通滤波算法。以上就是使用C#实现低通和高通滤波算法的示例代码。你可以根据自己的需求调整截止频率和采样率,将这些代码应用于你的项目中。是滤波器的截止频率,

XisVisual_Basic的博客 1274

手把手教你学Simulink--双足机器人的自动避障控制策略仿真

自动避障是双足机器人导航系统中的一个关键功能,它允许机器人在动态或静态环境中自主地避开障碍物。实现这一功能通常需要结合路径规划、环境感知和实时控制算法。在本教程中,我们将使用MATLAB和Simulink来创建一个简化版的双足机器人自动避障控制系统仿真。

MHD0815的博客 160

终于用VC/MFC做了一个真正的程序

        花了两天多的时间做了一个“信使服务”程序,呵呵,以前在网上见到过,居然要花钱注册的。其实就是用了那个NetMessageBufferSend函数,再用一个NetMessageNameAdd函数把随便一个名字加进去,就可以把自己的身份隐藏了。以前在学校的时候由于用的是固定IP,经常收到的很多广告就是用这种方式发送的。有时候在课堂上老师正在讲课,突然就冒出这么一个窗口来,十分气人,所以

amplifier@program 2572

微信小程序 - 解决报错 operateAudio:fail audioInstance is not set(wx.getRecorderManager苹果ios真机调试运行,播放音频播放出错解决)

微信小程序,苹果ios系统,真机测试报错,播放音频报错operateAudio:fail audioInstance not exist,errCode: -1,小程序生成音频播放报错errMsg,真机调试报错开发者工具没问题,wx.getRecorderManager,音频实例,InnerAudioContext,各种方法都试了不行,只有ios苹果手机有这个问题,IOS 出现 operateAudio,在iOS无法播放的解决方案,更新到最新版本了还是不行,链接没有特殊字符,微信小程序全局音频设置,手机上播

🏆 前端领域优质创作者 1万+

netmessagebuffersend示例

unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, StdCtrls;function ToUnicode(str:string;dest:PWideChar):integer;function SendMsg(Toh,F

705

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

netmessagebuffersend示例 (转)

netmessagebuffersend示例 (转)[@more@]unit Unit1; interface uses windows, Messages, SysUtils, Variants, Classes, Gr...

csd3176的博客 190

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

关于给居于网络里面的计算机发送消息的问题

Q :关于给居于网络里面的计算机发送消息的问题? 主要解答者:jianzhang提交人:zflying2000 感谢:li_zhifu、hnxrm 审核者:dext论坛对应贴子:查看 A : 我想问一个问题,就是如何通过程序控制对局域...

weixin_30650859的博客 99

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

delphi 调用系统dll文件

netmessagebuffersend示例 作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站 - unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,...

weixin_33938733的博客 192

message

private void button1_Click(object sender, EventArgs e) { byte[] bBuffer = System.Text.Encoding.Unicode.GetBytes(textBox2.Text); int nRet = NetMessageBufferSe...

weixin_30247307的博客 97

win2000/xp下的信使服务函数

netmessagebuffersend

不想写程序 1511

c语言局域网oicq程序,怎样用C实现局域网通信.解决方案

C/C++ code#define _UNICODE#define UNICODE#include #include #include #include #include #include #include #pragma comment(lib,"netapi32.lib")int wmain(int argc, wchar_t *argv[]){int count;wchar_t *wdest...

weixin_39734458的博客 289

信使服务 (Messenger)

对于Messenger您可能会立即想到一些人利用这个发垃圾广告。 但是在某些时候,我们利用这个服务来给管理员发送警告还是非常不错的。 /* *********************************************** Rainsoft Development Library for Microsoft.NET* * Copyright (c) 2004,2005 RainTrai...

v5qqcom 197

信使服务模拟器

private void btn_Send_Click(object sender, EventArgs e) { //byte[] buffer = System.Text.Encoding.Unicode.GetBytes(this.txtbox_SendContent.Text); int nRet = 0;

manbufenglin的专栏 881

Visual C#实现Windows信使服务

Visual C#实现Windows信使服务 现在有很多网络管理软件都具备网络上信息实时传送的功能,虽然有些网络通讯软件功能比较强大,有的软件不仅可以传送文本信息,还可以传送二进制文件等。但它们都有一个无法克服的缺点,那就是分发比较困难,信息传送双方计算机都需要安装通讯软件

夏敏捷的专栏 683

Visual C#实现Windows信使服务(转载)

 现在有很多网络管理软件都具备网络上信息实时传送的功能,虽然有些网络通讯软件功能比较强大,有的软件不仅可以传送文本信息,还可以传送二进制文件等。但它们都有一个无法克服的缺点,那就是分发比较困难,信息传送双方计算机都需要安装通讯软件的客户端和服务器端软件,并且只有但双方都打开相应软件时,才可能进行信息传送。而信使通讯就可以克服上述缺点,由于信使服务在Windows 2000系统以上都是自带的,并且此

wodefuture的专栏 732
上一篇: 如何在PB中编写PING代码?(改编)
下一篇: 浅谈PB使用心得(一)(原创)
balloonman2002
博客等级 码龄24年 115粉丝 30原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值