/*
TCP是NSIS检测系统端口是否占用的插件
TCP可以用于检测TCP端口是否被应用程序占用.此插件只可以检测端口是否可用,但比较实用.
*/
!AddPluginDir "."
OutFile "TCP.exe"
Section "永恒心锁"
validate_port:
#测试端口3306是否被占用
StrCpy $1 3306
TCP::CheckPort $1
Pop $0
StrCmp $0 "free" port_ok
StrCmp $0 "socket_error" socket_error
StrCmp $0 "inuse" socket_inuse
Goto port_ok
socket_inuse:
MessageBox MB_OK "此端口已经被其他应用程序占用."
Abort
socket_error:
MessageBox MB_OK "Invalid TCP Port number. It should be an integer between 1 and 65535."
Abort
port_ok:
SectionEnd
THE END
暂无评论内容