Creating winsocks (vbscript)

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
aDe
Forum Moderator
Posts: 138
Joined: 2003-01-07 09:14
Location: SE
Contact:

Creating winsocks (vbscript)

Post by aDe » 2003-01-16 04:09

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. :mad:

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..

oGbGo
Posts: 3
Joined: 2003-01-07 03:52

Post by oGbGo » 2003-01-16 10:33

Have u tried the Multi hub chat bot by stimerol? if im not totaly wrong that script does just what u ask for... or atleast thats my best guess.

GbG

aDe
Forum Moderator
Posts: 138
Joined: 2003-01-07 09:14
Location: SE
Contact:

Post by aDe » 2003-01-16 10:37

Yes. It creates a tcp socket and connects to the other hub, and sends data to it, but the data that is read is actually read from the socket in the other hub. I need the created socket to recieve data.

FRANKE
Posts: 26
Joined: 2003-01-03 11:29
Location: Denmark
Contact:

Post by FRANKE » 2003-01-16 10:52

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

Stimorol
Posts: 2
Joined: 2003-01-17 04:04

Re: Creating winsocks (vbscript)

Post by Stimorol » 2003-01-17 04:14

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.
aDe,

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

aDe
Forum Moderator
Posts: 138
Joined: 2003-01-07 09:14
Location: SE
Contact:

Post by aDe » 2003-01-17 05:06

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!

TasMan
Posts: 196
Joined: 2003-01-03 08:31
Location: Canada
Contact:

Post by TasMan » 2003-01-17 06:42

Well the multi hub search uses UDP, and the HubDataChunkIn sub (spelling?) might still work. 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)

aDe
Forum Moderator
Posts: 138
Joined: 2003-01-07 09:14
Location: SE
Contact:

Post by aDe » 2003-01-17 06:58

I tried it.. nothing.. I guess the hub wont send data to that event.. it says in the readme that it is obsolete

Stimorol
Posts: 2
Joined: 2003-01-17 04:04

Post by Stimorol » 2003-01-17 09:51

aDe wrote:Hmm, sounds like new adventures for me, do you have any example of using an ocx? How about using winsock ocx? hehe :)
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.

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

aDe
Forum Moderator
Posts: 138
Joined: 2003-01-07 09:14
Location: SE
Contact:

Post by aDe » 2003-01-17 11:44

Thanks, do you have an example how to recieve the events script and i'll figure out the rest myself,..?

Atomic Jo
Posts: 62
Joined: 2003-01-04 03:50
Location: Québec, Canada
Contact:

Post by Atomic Jo » 2003-01-17 21:00

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)
Here are all controls (with name) contained in the "frmHub" (access to these controls by the frmHub object):

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

Locked