|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Winsock API callback eventsI need to create a winsock enabled component, but without a GUI. I therefore cannot use VB's included Winsock control. If my understanding is correct, the only way to achieve my goal is my using the winsock API directly. I have gone through a tutorial (http://www.vbip.com/winsock-api/default.asp) and it all makes sense, but I have one hangup: Do I have to keep periodically checking the "IsDataAvailable" function myself, or is there some way to register a callback function for the equivalent of the Winsock control's "DataArrival" event (among others...) Maybe I am going about it the wrong way? Is there a better way? Thanks in advance for any help... Nicolas *** Sent via Developersdex http://www.developersdex.com ***
Show quote
Hide quote
"Nicolas Noakes" <annesvi***@hotmail.com> wrote in message Have you looked at CSocketMaster, this is a Class Module written in VB.news:%23ah%23Bu4vFHA.3688@tk2msftngp13.phx.gbl... > Hello, > > I need to create a winsock enabled component, but without a GUI. I > therefore cannot use VB's included Winsock control. If my understanding > is correct, the only way to achieve my goal is my using the winsock API > directly. > > I have gone through a tutorial > (http://www.vbip.com/winsock-api/default.asp) and it all makes sense, > but I have one hangup: Do I have to keep periodically checking the > "IsDataAvailable" function myself, or is there some way to register a > callback function for the equivalent of the Winsock control's > "DataArrival" event (among others...) > > Maybe I am going about it the wrong way? Is there a better way? > > Thanks in advance for any help... > > Nicolas > > *** Sent via Developersdex http://www.developersdex.com *** If you have already used the WinSock Control then conversion to CSocketMaster is quite simple. I have used it in a couple of big projects and had no problems with it under Windows 2000, 2003 and XP. John.. You may have already considered this, but just in case...
You could include a form to hold the Wincock control, and leave it invisible. You may find the form useful while debugging communications. HTH, DRBarkley Show quoteHide quote "Nicolas Noakes" <annesvi***@hotmail.com> wrote in message news:%23ah%23Bu4vFHA.3688@tk2msftngp13.phx.gbl... > Hello, > > I need to create a winsock enabled component, but without a GUI. I > therefore cannot use VB's included Winsock control. If my understanding > is correct, the only way to achieve my goal is my using the winsock API > directly. > > I have gone through a tutorial > (http://www.vbip.com/winsock-api/default.asp) and it all makes sense, > but I have one hangup: Do I have to keep periodically checking the > "IsDataAvailable" function myself, or is there some way to register a > callback function for the equivalent of the Winsock control's > "DataArrival" event (among others...) > > Maybe I am going about it the wrong way? Is there a better way? > > Thanks in advance for any help... > > Nicolas > > *** Sent via Developersdex http://www.developersdex.com *** John,
Thanks for the tip regarding the CSocketMaster class. I had seen the original CSocket class by Oleg Gdalevich (see http://www.vbip.com/winsock-api/csocket-class/csocket-class-01.asp) but it was last visited in 2002 and I was a little wary of marching on with it. The CSocketMaster by Emiliano Scavuzzo (see http://www.geocities.com/anshoku/index.html) is much more complete, and includes examples of use. Secondly, the latest version was released earlier this year! In addition to the CSocketMaster, there is also a CSocketPlus which includes support for creating "arrays" of sockets (altho it looks at first glance more like a collection structure). DRBarkley, Thanks for the suggestion - I considered that option myself, but felt it was rather kludgy. Has anyone successfully used this method before in a finished product? Thanks all for you comments, Nicolas *** Sent via Developersdex http://www.developersdex.com ***
Show quote
Hide quote
"Nicolas Noakes" <annesvi***@hotmail.com> wrote in message Thanks for the feedback on CSocketMaster. I was not aware of the latestnews:%23HWhDEBwFHA.1148@TK2MSFTNGP11.phx.gbl... > John, > > Thanks for the tip regarding the CSocketMaster class. I had seen the > original CSocket class by Oleg Gdalevich (see > http://www.vbip.com/winsock-api/csocket-class/csocket-class-01.asp) but > it was last visited in 2002 and I was a little wary of marching on with > it. > > The CSocketMaster by Emiliano Scavuzzo (see > http://www.geocities.com/anshoku/index.html) is much more complete, and > includes examples of use. Secondly, the latest version was released > earlier this year! In addition to the CSocketMaster, there is also a > CSocketPlus which includes support for creating "arrays" of sockets > (altho it looks at first glance more like a collection structure). > > DRBarkley, > > Thanks for the suggestion - I considered that option myself, but felt it > was rather kludgy. Has anyone successfully used this method before in a > finished product? > > Thanks all for you comments, > Nicolas > > *** Sent via Developersdex http://www.developersdex.com *** version 1.3 as I'm running 1.2. When I get chance I'll download 1.3 and try it. I not had any problems with 1.2 but it does indicate that there were minor bugs in it, so it will be worth trying. The new site is very slow at present so I'll try downloading in a few hours time. John.. >Thanks for the suggestion - I considered that option myself, but felt it I have quite a few programs out there that have an invisible form.>was rather kludgy. Has anyone successfully used this method before in a >finished product? > I put winsocks on it. And timers. And a couple of other ActiveX things that don't have a user interface. No one ever knows it's there except me. |
|||||||||||||||||||||||