Creating winsocks (vbscript)
Moderator: Moderators
Creating winsocks (vbscript)
I would like to know how to create a listening UDP winsock in a script for a NMDC hub and actually recieveing data on it...
I have created a winsock, made it udp, bound it, had it all setup but- I can't get any data from it.
Sending data is easier.. but I don't know how to capture the winsock's dataarrival sub. And i tried getting the data everynow and then with a timer, but I couldn't get that to work either.
Perhaps someone knows how to make the script contol fire a new sub for the socket, or some other way to get the data.
Thanks..
I have created a winsock, made it udp, bound it, had it all setup but- I can't get any data from it.
Sending data is easier.. but I don't know how to capture the winsock's dataarrival sub. And i tried getting the data everynow and then with a timer, but I couldn't get that to work either.
Perhaps someone knows how to make the script contol fire a new sub for the socket, or some other way to get the data.
Thanks..
I have been playing with this too, but i dont think it is possible to get the "_DataArrival" event in a script
For the newest release of MulTiBoT visit www.cwain.dk
Re: Creating winsocks (vbscript)
aDe,aDe wrote:I would like to know how to create a listening UDP winsock in a script for a NMDC hub and actually recieveing data on it...
I have created a winsock, made it udp, bound it, had it all setup but- I can't get any data from it.
I tried to do this, too, without luck. What you have to do, as far as I understand VBScript, is to Dim udpCommunication As Control Withevents. Now, this is not allowed in VBScript, partly because the Withevents keyword isn't available, and partly because even if it were, it would require an As Type declaration, which again, and more fundamentally, isn't allowed in VBScript.
Off the top of my head, your best solution would be to create an OCX, and just have a very short Sub Main() in the .script file, creating an instance of the OCX, and adding it to the hub. Possibly, you could also let this OCX raise events (either new ones, declared by you, or existing ones); if nothing else works, I suppose you could do this by calling the script control's script module that's running your .script file and executing commands... not that I've tried it, but it should work.
Kind regards,
Stimorol
Hmm, sounds like new adventures for me, do you have any example of using an ocx? How about using winsock ocx? hehe
I tried playing with the script control.. no luck. The DataArival event is raised in the winsock dataarrival (wskLoop) sub which logically can't be accessed..
I must, must figure out a way!
I tried playing with the script control.. no luck. The DataArival event is raised in the winsock dataarrival (wskLoop) sub which logically can't be accessed..
I must, must figure out a way!
Hehe, what I meant was that instead of writing a .script file in Notepad, you open the Visual Basic IDE, create a new project, type OCX (it's called Activex DLL or something, but it's not the ActiveX Document DLL), and then you build a program. That program can use any other OCX components, as well as everything else in real VB, including the Winsock control, and it can receive events. Then, when you're done, you compile the program, get an OCX, and then you distribute that, together with a small .script file which puts your OCX on the hub form and starts it.aDe wrote:Hmm, sounds like new adventures for me, do you have any example of using an ocx? How about using winsock ocx? hehe
Nope, sorry. I've done parts of this - building an OCX and placing it on the hub, but that was some time ago, and I've mostly left the scene now, so I didn't even save the code. Real life decided to come back on me. :-/
I'll tell you though, if you've got some experience with Visual Basic (I used 6.0), this isn't hard.
Good luck whichever way you choose to try it.
/Stimorol
Here are all controls (with name) contained in the "frmHub" (access to these controls by the frmHub object):TasMan wrote:
[...]
I have a list of the control names but I can't remember the name for the winsock - I need to find my list....course you probably know it...(if not pm me)
Code: Select all
chkAutoRedirect
chkAutoReg
chkAutoStart
chkDoNotSendChatMessagesToAFKUsers
chkFloodProtection
chkOnlyRegedNicks
chkPrivateOnJoin
chkRedirectIfFull
chkRunScripts
chkWriteLog
cmdAddOp
cmdAddPermBan
cmdMassMsg
cmdMultiHubAdd
cmdReDirect
cmdStartServing
DcSysTray
fraClientActions
fraClientInterations
fraClientStatus
fraInvisControls
fraMultiHub
fraNetworkSetup
fraOptimizations
fraPermBan
fraReginfo
fraSecurity
fraStatistics
fraStatus
fraTempBan
HubScripts
Label1
lblCurrentUsers
lblMaxUser
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblNoEvents
lblOperators
lblPeakUsers
lstClients
lstErrors
lstMultiHubs
lstOpActions
lstOps
lstPermBan
lstSelector
lstStatus
lstTempBan
ScriptTimer
sldrMaxUsers
smallIcons
stsHub
tmrFastBGWork
tmrSlowBGWork
txtBotPass
txtDescription
txtIP
txtListenPort
txtMaxChatCPS
txtMinClientVersion
txtMultiHubPass
txtMultiHubRemoteIP
txtMultiHubRemoteport
txtName
txtOnjoin
txtRedirect
txtRegAddress
udMaxChatCPS
wskLoop
wskLoop
wskLoop
wskLoop
wskLoop
wskLoop
wskLoop
wskLoop
wskLoop
wskLoop
wskLoop
wskLoop
wskLoop
wskReg
wskSearch